Function::Override - Add callbacks to existing functions.
use Function::Override; use Carp; BEGIN { override('open', sub { my $wantarray = (caller(1))[5]; carp "You didn't check if open() succeeded" unless defined $wantarray; } ); } open(FILE, $filename); # This produces a warning now. print <FILE>; close FILE;
** THIS IS ALPHA CODE! **
Function::Override provides a way to conveniently add code to existing functions.
You may wrap both user-defined functions and overridable CORE operators in this way. Although if you override a CORE function its usually wise to do it in a BEGIN block so Perl will see it.
Add a more flexible callback system offering pre and post function routines.
Offer more information to the callback, such as the subroutine name.
Merge Fatal.pm and possiblely Memoize.pm.
If true, this flag turns on debugging output.
Michael G Schwern <schwern@pobox.com> but its really 99.99% Fatal.pm by Lionel.Cons@cern.ch
Fatal
To install Function::Override, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Function::Override
CPAN shell
perl -MCPAN -e shell install Function::Override
For more information on module installation, please visit the detailed CPAN module installation guide.