<?xml version="1.0" encoding="windows-1252"?>
<node id="1000198" title="Re^2: Core module: Attribute::Handlers behaviour" created="2012-10-21 06:46:02" updated="2012-10-21 06:46:02">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
&lt;p&gt; I don't get that, even though your module doesn't return an object ( compared to [mod://Attribute::Constructor] ), trace gets called if the phase is BEGIN
&lt;c&gt;$ perl -le " eval qq/use Junk;/; print Junk-&gt;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 )= &amp;$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;&lt;/c&gt;</field>
<field name="root_node">
1000101</field>
<field name="parent_node">
1000192</field>
<field name="reputation">
2</field>
</data>
</node>
