NAME

Function::Override - Add callbacks to existing functions.

SYNOPSIS

    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;
                              

DESCRIPTION

** 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.

TODO

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.

ENVIRONMENT

PERL_FUNCTION_OVERRIDE_DEBUG

If true, this flag turns on debugging output.

AUTHOR

Michael G Schwern <schwern@pobox.com> but its really 99.99% Fatal.pm by Lionel.Cons@cern.ch

SEE ALSO

Fatal