]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - lib/Scope/Upper.pm
A better explaination of how string symbols work
[perl/modules/Scope-Upper.git] / lib / Scope / Upper.pm
index 1d6b4d11a70a002d5396f4d3999df902ae9275c0..91219ff91e5b7fcd63cf1027d022412d35bce5d1 100644 (file)
@@ -9,13 +9,13 @@ Scope::Upper - Act on upper scopes.
 
 =head1 VERSION
 
-Version 0.08
+Version 0.10
 
 =cut
 
 our $VERSION;
 BEGIN {
- $VERSION = '0.08';
+ $VERSION = '0.10';
 }
 
 =head1 SYNOPSIS
@@ -144,11 +144,23 @@ will set C<$x> to a reference to the string C<'foo'>.
 Other sigils (C<'@'>, C<'%'>, C<'&'> and C<'*'>) require C<$value> to be a reference of the corresponding type.
 
 When the symbol is given by a string, it is resolved when the actual localization takes place and not when C<localize> is called.
-This means that
+Thus, if the symbol name is not qualified, it will refer to the variable in the package where the localization actually takes place and not in the one where the C<localize> call was compiled.
+For example,
+
+    {
+     package Scope;
+     sub new { localize '$tag', $_[0] => UP }
+    }
 
-    sub tag { localize '$x', $_[0] => UP }
+    {
+     package Tool;
+     {
+      Scope->new;
+      ...
+     }
+    }
 
-will localize in the caller's namespace.
+will localize C<$Tool::tag> and not C<$Scope::tag>.
 
 =back
 
@@ -209,7 +221,7 @@ The previous example can then be "corrected" :
      # not reached
     }->();
 
-will righteously set C<$num> to C<26>.
+will rightfully set C<$num> to C<26>.
 
 =head1 CONSTANTS
 
@@ -378,6 +390,9 @@ L<XSLoader> (standard since perl 5.006).
 
 L<Alias>, L<Hook::Scope>, L<Scope::Guard>, L<Guard>.
 
+L<Continuation::Escape> is a thin wrapper around L<Scope::Upper> that gives you a continuation passing style interface to L</unwind>.
+It's easier to use, but it requires you to have control over the scope where you want to return.
+
 =head1 AUTHOR
 
 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
@@ -386,7 +401,8 @@ You can contact me by mail or on C<irc.perl.org> (vincent).
 
 =head1 BUGS
 
-Please report any bugs or feature requests to C<bug-scope-upper at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Scope-Upper>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
+Please report any bugs or feature requests to C<bug-scope-upper at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Scope-Upper>.
+I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
 
 =head1 SUPPORT
 
@@ -404,7 +420,7 @@ Thanks to Shawn M. Moore for motivation.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2008-2009 Vincent Pit, all rights reserved.
+Copyright 2008,2009,2010 Vincent Pit, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.