X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FVariable%2FMagic.pm;h=c10a8057505178e62918bfae94d7bad51df0f927;hb=c8c5b403ecc90d2e086627edcc2806a3316850a1;hp=5c049322588e47cd50db032e14a8a01083420c68;hpb=7ec09aef1ade5d56c2a436093a35447035705e22;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 5c04932..c10a805 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -11,13 +11,13 @@ Variable::Magic - Associate user-defined magic to variables from Perl. =head1 VERSION -Version 0.43 +Version 0.44 =cut our $VERSION; BEGIN { - $VERSION = '0.43'; + $VERSION = '0.44'; } =head1 SYNOPSIS @@ -300,18 +300,26 @@ sub wizard { } my %opts = @_; + my @keys = qw/data op_info get set len clear free/; push @keys, 'copy' if MGf_COPY; push @keys, 'dup' if MGf_DUP; push @keys, 'local' if MGf_LOCAL; push @keys, qw/fetch store exists delete copy_key/ if VMG_UVAR; - my $ret = eval { _wizard(map $opts{$_}, @keys) }; - if (my $err = $@) { + + my ($wiz, $err); + { + local $@; + $wiz = eval { _wizard(map $opts{$_}, @keys) }; + $err = $@; + } + if ($err) { $err =~ s/\sat\s+.*?\n//; require Carp; Carp::croak($err); } - return $ret; + + return $wiz; } =head2 C