Sub::Versive

Sub::Versive is a subroutine with pre- and post-handlers.
Download

Sub::Versive Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Simon Cozens
  • Publisher web site:
  • http://search.cpan.org/~simon/Sub-Versive-0.01/Versive.pm

Sub::Versive Tags


Sub::Versive Description

Sub::Versive is a subroutine with pre- and post-handlers. Sub::Versive is a subroutine with pre- and post- handlers.SYNOPSIS use Sub::Versive qw(append_to_sub prepend_to_sub builtinify); sub foo { print "Hi theren"; } append_to_sub { print "Doing foo() now"; } &foo; prepend_to_sub { print "Finished"; } &foo; prepend_to_sub { print "Yes, it's stackable"; } &foo; prepend_to_sub { $@="Hijacked!"; do_something_else() } builtinify &foo; package bar; foo(); # Still works.The synopsis pretty much tells you all you need to know. You can add pre- and post-actions to subroutines, stack them, have them force a return, and make a subroutine available from everywhere.I'm sorry, incidentally, that this needs 5.6.1 and above, especially since 5.6.1 isn't released right now. This is because of the prototyping behaviour. If you want to make it work with 5.6.0, zap the prototypes and pass subroutine references instead of subroutine names. I just vastly prefer the syntax, that's all. You'll still need Devel::Peek from 5.6.0, though. Requirements: · Perl


Sub::Versive Related Software