BioPerl-Network
view release on metacpan or search on metacpan
t/lib/Sub/Uplevel.pm view on Meta::CPAN
The main reason I wrote this module is so I could write wrappers
around functions and they wouldn't be aware they've been wrapped.
use Sub::Uplevel;
my $original_foo = \&foo;
*foo = sub {
my @output = uplevel 1, $original_foo;
print "foo() returned: @output";
return @output;
};
If this code frightens you B<you should not use this module.>
=head1 BUGS and CAVEATS
Sub::Uplevel must be used as early as possible in your program's
compilation.
Well, the bad news is uplevel() is about 5 times slower than a normal
function call. XS implementation anyone?
Blows over any CORE::GLOBAL::caller you might have (and if you do,
you're just sick).
=head1 HISTORY
Those who do not learn from HISTORY are doomed to repeat it.
The lesson here is simple: Don't sit next to a Tcl programmer at the
dinner table.
=head1 THANKS
Thanks to Brent Welch, Damian Conway and Robin Houston.
=head1 AUTHORS
David A Golden E<lt>dagolden@cpan.orgE<gt> (current maintainer)
Michael G Schwern E<lt>schwern@pobox.comE<gt> (original author)
=head1 LICENSE
Copyright by Michael G Schwern, David A Golden
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
=head1 SEE ALSO
PadWalker (for the similar idea with lexicals), Hook::LexWrap,
Tcl's uplevel() at http://www.scriptics.com/man/tcl8.4/TclCmd/uplevel.htm
=cut
1;
( run in 2.506 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )