Help for this page

Select Code to Download


  1. or download this
    my $package_method = 'Foo::Bar::baz';
    my $orig = \&($package_method};
    no warnings;
    *{$package_method} = sub { pre(); $orig->(@_); post() };
    
  2. or download this
    package Foo::Bar;
    sub baz { print "I am the original!\n" }
    ...
    sub Foo::Bar::baz { print "I am the new baz!\n" }
    
    Foo::Bar::baz();