X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=samples%2Ftag.pl;h=0e2e63279d56f1250a68e7976d3cbfc8ef26d9da;hb=0a6221d3f467b5f819e3c119b4cda0218399cb51;hp=03a2fbed8d1a791d28adb9924d561dcec3f87060;hpb=e4bb8d889bcaaf2a3c9f1f9cd2a8185115db5db0;p=perl%2Fmodules%2FScope-Upper.git diff --git a/samples/tag.pl b/samples/tag.pl index 03a2fbe..0e2e632 100644 --- a/samples/tag.pl +++ b/samples/tag.pl @@ -7,7 +7,7 @@ use warnings; use blib; -use Scope::Upper qw/reap localize localize_elem localize_delete/; +use Scope::Upper qw/reap localize localize_elem localize_delete UP/; sub desc { shift->{desc} } @@ -15,21 +15,21 @@ sub set_tag { my ($desc) = @_; # First localize $x so that it gets destroyed last - localize '$x' => bless({ desc => $desc }, __PACKAGE__) => 1; + localize '$x' => bless({ desc => $desc }, __PACKAGE__) => UP; reap sub { my $pkg = caller; my $x = do { no strict 'refs'; ${$pkg.'::x'} }; # Get the $x in the scope print $x->desc . ": done\n"; - } => 1; + } => UP; localize_elem '%SIG', '__WARN__' => sub { my $pkg = caller; my $x = do { no strict 'refs'; ${$pkg.'::x'} }; # Get the $x in the scope CORE::warn($x->desc . ': ' . join('', @_)); - } => 1; + } => UP; - localize_delete '@ARGV', $#ARGV => 1; # delete last @ARGV element + localize_delete '@ARGV', $#ARGV => UP; # delete last @ARGV element } package main;