Hook::PrePostCall

Hook::PrePostCall is a Perl module that can add actions before and after a routine.
Download

Hook::PrePostCall Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Philippe Verdret
  • Publisher web site:
  • http://search.cpan.org/~yvesp/llg-1.07/LLg.en.pod

Hook::PrePostCall Tags


Hook::PrePostCall Description

Hook::PrePostCall is a Perl module that can add actions before and after a routine. Hook::PrePostCall is a Perl module that can add actions before and after a routine.SYNOPSIS require 5.000; use Hook::PrePostCall; sub try { print STDERR "in try: @_n"; @_; } PrePostCall->new( 'try', sub { print STDERR "pre: @_n"; # process the @_ content...if you want @_; # defines the 'try' arguments }, sub { print STDERR "post: @_n"; # process the @_ content...if you want @_; # defines what the 'try' returns } ); print try(10), "n";new() creates a new object of the Hook::PrePostCall class. Arguments of the new method are:1. the name of the primary routine you want to "overload",2. an anonymous routine to call before the primary routine,3. an anonumous routine to call after the primary routine.If the name of the primary subroutine has not an explicit package prefix, it is assumed to be the name of a subroutine in the current package of the caller of the new() method.The pre routine acts as a filter of the primary routine arguments. The post routine acts as a filter of what the primary returns.new() can be used as a class or an object method. When used as an object method the derived definition is built from the initial definition of the primary routine.derived() Returns the overloaded routine.pre() Returns or set the pre action part.post() Returns or set the post action part.primary() Returns the primary routine.restore() Retore initial definition of the primary routine. Requirements: · Perl


Hook::PrePostCall Related Software