develooper Front page | perl.perl5.porters | Postings from March 2012

Re: doco improvement for

Thread Previous | Thread Next
March 28, 2012 13:42
Re: doco improvement for
Message ID:
On Wed, Feb 29, 2012 at 12:40 PM, David Cantrell <> wrote:
> On Thu, Feb 16, 2012 at 05:06:51PM +0000, I wrote:
>> +It is up to this method to store the list of attributes if they will be
>> +needed later, as well as checking for any errors.  In this example there
>> +are no error conditions, so we just store:
>> +
>> +  my %attrs;
>> +    my($package, $subref, @attrs) = @_;
>> +    $attrs{ refaddr $subref } = \@attrs;
>> +    return;
>> +  }
> Turns out that blindly looking at refaddr($subref) doesn't always Do The
> Right Thing.  This code gets called when the subroutine with attributes
> is being compiled, and if it's a closure you sometimes (maybe always?)
> get a different refaddr at this point than the subroutine ends up with
> after it's been compiled.  I have no idea off the top of my head how to
> fix this to take that into account.
> Also I seem to remember there being some Argument recently about whether
> refaddr() should be in core or not but forget what the final decision
> was.  In this case (modulo the closure stuff above) simply stringifying
> the subref does the job, so refaddr can be cut out.

Should the docs be updated again then? The original patch is still
applied and this last email seems to indicate it needs to be changed.

-- Matthew Horsfall (alh)

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