Context-Preserve
view release on metacpan or search on metacpan
lib/Context/Preserve.pm view on Meta::CPAN
# ABSTRACT: Run code after a subroutine call, preserving the context the subroutine would have seen if it were the last statement in the caller
use strict;
use warnings;
use Carp;
use base 'Exporter';
our @EXPORT = qw(preserve_context);
our $VERSION = '0.03';
sub preserve_context(&@) {
my $orig = shift;
my %args = @_;
my $replace = $args{replace};
my $after = $args{after};
croak 'need an "after" or "replace" coderef'
unless $replace || $after;
if(!defined wantarray){
( run in 0.873 second using v1.01-cache-2.11-cpan-49f99fa48dc )