]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - samples/tag.pl
Doc update
[perl/modules/Scope-Upper.git] / samples / tag.pl
index 0e2e63279d56f1250a68e7976d3cbfc8ef26d9da..e28aae00488b239c633161caba55de0b90db19c4 100644 (file)
@@ -7,7 +7,9 @@ use warnings;
 
 use blib;
 
-use Scope::Upper qw/reap localize localize_elem localize_delete UP/;
+use Scope::Upper qw/reap localize localize_elem localize_delete :words/;
+
+die 'run this script with some arguments!' unless @ARGV;
 
 sub desc { shift->{desc} }
 
@@ -21,15 +23,16 @@ sub set_tag {
   my $pkg = caller;
   my $x = do { no strict 'refs'; ${$pkg.'::x'} }; # Get the $x in the scope
   print $x->desc . ": done\n";
- } => UP;
+ } => SCOPE 1; # same as UP here
 
  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('', @_));
- } => UP;
+ } => UP CALLER 0; # same as UP here
 
- localize_delete '@ARGV', $#ARGV => UP; # delete last @ARGV element
+ # delete last @ARGV element
+ localize_delete '@ARGV', -1 => UP SUB HERE; # same as UP here
 }
 
 package main;
@@ -41,4 +44,5 @@ use warnings;
  X::set_tag('pie');
  # $x is now a X object, and @ARGV has one element less
  warn 'what'; # warns "pie: what at ..."
+ warn "\@ARGV contains [@ARGV]";
 } # "pie: done" is printed