develooper Front page | perl.perl5.porters | Postings from September 2009

Re: waiting for sub body

Thread Previous | Thread Next
September 2, 2009 17:23
Re: waiting for sub body
Message ID:
rgs pointed out to me that attribute handlers being applied to a temporary
CV has actually been reported as a bug, #66970.  The attached patch fixes
the bug, by changing the order in which things happen: attributes are
now applied after the temporary CV has been merged into the existing CV
or has otherwise been added to the appropriate GV.

The change breaks part of Attribute::Handlers.  Part of A:H searches
the package to find the name of the sub to which a :ATTR attribute
is being applied, and the correct time at which to launch that search
depends crucially on the order in which the CV construction events occur.
So this patch also includes a change to A:H, to make it detect which way
things happen.  The resulting A:H works either way, which is essential
for its dual-life nature.

Along the way I discovered a manifestation of bug#66970 with A:H:

$ perl -MAttribute::Handlers -lwe 'sub A0; sub A0 :ATTR(CODE) { print "a0" } sub t0 :A0 {123}'
Internal error: main symbol went missing at /usr/share/perl/5.10/Attribute/ line 96.
BEGIN failed--compilation aborted at -e line 1.
Internal error: main symbol went missing at /usr/share/perl/5.10/Attribute/ line 96.
CHECK failed--call queue aborted at -e line 1.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About