Re: my $self = shift

2010-09-12 Thread Aristotle Pagaltzis
* Shawn H Corey shawnhco...@gmail.com [2010-09-10 14:30]: On 10-09-10 03:02 AM, Eric Wilhelm wrote: sub foo { my $self = shift; my $self = shift @_; Always put the array in the shift. Why? Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/

Re: my $self = shift

2010-09-12 Thread Aristotle Pagaltzis
* Darren Chamberlain d...@sevenroot.org [2010-09-11 10:05]: Template Toolkit (and several other modules) use this idiom: sub new { my $class = shift; # allow hash ref as first argument, otherwise fold args into hash my $config = defined $_[0] UNIVERSAL::isa($_[0], 'HASH') ?

Re: my $self = shift

2010-09-12 Thread Shawn H Corey
On 10-09-12 04:58 PM, Aristotle Pagaltzis wrote: * Shawn H Coreyshawnhco...@gmail.com [2010-09-10 14:30]: On 10-09-10 03:02 AM, Eric Wilhelm wrote: sub foo { my $self = shift; my $self = shift @_; Always put the array in the shift. Why? Regards, So you will never have

Re: my $self = shift

2010-09-12 Thread Aristotle Pagaltzis
* Shawn H Corey shawnhco...@gmail.com [2010-09-12 23:15]: So you will never have experienced Perl programmers come up to you and ask, What does this shift do? It doesn't do anything; @_ is not set yet. Good Advice, #11905: “Now is the time in our program where you look at the manual.”