Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Core module: Attribute::Handlers behaviour

by Anonymous Monk
on Oct 21, 2012 at 10:46 UTC ( #1000198=note: print w/ replies, xml ) Need Help??


in reply to Re: Core module: Attribute::Handlers behaviour
in thread Core module: Attribute::Handlers behaviour

I don't get that, even though your module doesn't return an object ( compared to Attribute::Constructor ), trace gets called if the phase is BEGIN

$ perl -le " eval qq/use Junk;/; print Junk->new " Junk.pm(22) called with [Junk] Junk.pm(22): returning [ Junk=HASH(0x3f8d1c) ] 1 $ cat Junk.pm package Junk; use Attribute::Handlers; #~ sub TRACE :ATTR(CODE,CHECK) { #~ sub TRACE :ATTR(CODE,INIT,CHECK) { #~ sub TRACE :ATTR(CODE,INIT) { sub TRACE :ATTR(CODE,BEGIN) { #~ sub TRACE :ATTR(CODE) { my ($pkg, $sym, $ref, $attr, $data, $phase, $file, $line) = @_; *{ $sym } = sub { warn "$file($line) called with [@_]\n"; my( @rc )= &$ref; warn "$file($line): returning [ @rc ]\n"; } } sub new :TRACE { my $instance = shift; my $class = ref($instance) || $instance; my $self = {}; return bless($self, $class); } 1;


Comment on Re^2: Core module: Attribute::Handlers behaviour
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-09-21 21:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls