On Wed, Sep 17, 2003 at 09:47:43AM +0100, Tom Insam wrote:
> At 17:59 +0100 2003/09/16, Steve Purkis wrote:
> >
> >Secondly, with the current implementation an 'undef' argument will 
> >trigger a set for both 'classic' and 'chained' accessors:
> >
> >     $book->author($a); # still sets when $a = undef
> >
> 
> How? I can't see how that would work..

@_ will still have an element in it after shifting off $self, so the
old favourite:

 sub foo {
     my $self = shift;
     if (@_) {
         $self->{foo} = shift;
     }
     $self->{foo}; # or $self;
 }

Will still have something to assign.

-- 
Richard Clamp <[EMAIL PROTECTED]>

Reply via email to