Incidentally, I just implemented pre- and post- handlers on subroutines
in pure Perl 5, without any changes to the language. Interesting, huh?

sub foo { print "Bar\n"; }
append_to_sub {print "After!\n"} &foo; # Perl 5.6.x (&\&) syntax
append_to_sub {print "After!\n"}, \&foo; # Perl <5.6 syntax

foo();

Bar
After!

This actually came as a side-track to something else I was doing which was to
make some subroutines appear like builtins; (available from all packages)
I'll put Sub::Versive on CPAN when I've done *that*.

-- 
The Messiah will come.  There will be a resurrection of the dead -- all
the things that Jews believed in before they got so damn sophisticated.
- Rabbi Meir Kahane

Reply via email to