1#! /usr/local/bin/perl -w 2 3use Attribute::Handlers; 4 5sub Prefix : ATTR { 6 my ($glob, $sub) = @_[1,2]; 7 no warnings 'redefine'; 8 *$glob = sub { 9 print "This happens first\n"; 10 $sub->(@_); 11 }; 12} 13 14sub Postfix : ATTR { 15 my ($glob, $sub) = @_[1,2]; 16 no warnings 'redefine'; 17 *$glob = sub { 18 $sub->(@_); 19 print "This happens last\n"; 20 }; 21} 22 23sub test : Postfix Prefix { 24 print "Hello World\n"; 25} 26 27test(); 28