[JOB] Perl Software Developer and Database programmer

Dominic Mitchell dom at happygiraffe.net
Thu Feb 23 13:30:07 GMT 2006


On Thu, Feb 23, 2006 at 12:08:08PM +0000, Peter Hickman wrote:
> A particularly irksome idiom is:
> 
> sub whatever {
>    my $value = shift;
> 
>    # Loads of code
>    my $other = shift;
>    # Loads more code
>    harry(@_);
> }
> 
> Don't even go there.

But this is actually the /correct/ idiom for OO code:

  sub mymethod {
    my $self = shift;
    my ( $arg1, $arg2 ) = @_;
    ...
  }

ie: shifting the object of the front of the arguments array because it's
not really part of the arguments.

-Dom


More information about the london.pm mailing list