package Module; use Attribute::Handlers; sub TRACE :ATTR(CODE,BEGIN) { 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;