- or download this
use Sub::Prepend 'prepend';
...
__END__
Foo was called with @_ = (3).
Foo executed with @_ = (3).
- or download this
my $old = \&foo;
*foo = sub { ...; goto &$old };
- or download this
use Scalar::Util 'set_prototype';
...
no warnings 'redefine';
*$name = $new;
}
- or download this
prepend(foo => sub { ... });
- or download this
prepend(foo => sub ($) { ... });
prepend(foo => sub { ... }, { prototype => '$' });