develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24118] AutoReply: attribute bug on 'our' in Attribute::Handlers

Thread Previous
From:
Richard Clamp
Date:
October 5, 2003 04:41
Subject:
Re: [perl #24118] AutoReply: attribute bug on 'our' in Attribute::Handlers
Message ID:
20031005114106.GA9089@mirth.demon.co.uk
On Sun, Oct 05, 2003 at 04:19:13AM -0700, Jos I. Boumans wrote:
> So for the first part of this bug report, it was my expectation being
> wrong, and not a bug... however, it does make me wonder why the behaviour
> of our vs my is different...

It's so that attributes get (re)applied correctly to lexicals.
Consider calling these subroutines:

sub tail { 
   my $dog : Hairy;
   ...
}

sub story {
   our $dolly : Cute;
}

On every invocation of tail we have a new $dog, so it has to be make
Hairy at runtime.  Ever every time we tell the story we use the same
$dolly which was made Cute at time of manufacture.

-- 
Richard Clamp <richardc@unixbeard.net>

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About