r58490 - in /trunk/libtry-tiny-perl: Changes MANIFEST META.yml SIGNATURE debian/changelog lib/Try/Tiny.pm t/given_when.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Thu May 27 00:32:10 UTC 2010


Author: jawnsy-guest
Date: Thu May 27 00:32:03 2010
New Revision: 58490

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=58490
Log:
Documentation fixes only
IGNORE-VERSION: 0.05-1
* New upstream release

Added:
    trunk/libtry-tiny-perl/t/given_when.t
      - copied unchanged from r58489, branches/upstream/libtry-tiny-perl/current/t/given_when.t
Modified:
    trunk/libtry-tiny-perl/Changes
    trunk/libtry-tiny-perl/MANIFEST
    trunk/libtry-tiny-perl/META.yml
    trunk/libtry-tiny-perl/SIGNATURE
    trunk/libtry-tiny-perl/debian/changelog
    trunk/libtry-tiny-perl/lib/Try/Tiny.pm

Modified: trunk/libtry-tiny-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/Changes?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/Changes (original)
+++ trunk/libtry-tiny-perl/Changes Thu May 27 00:32:03 2010
@@ -1,3 +1,6 @@
+0.05
+	- Documentation fixes and clarifications
+
 0.04
 	- Restore list context propagation for catch blocks
 	- Fix a bug where finally blocks weren't always invoked

Modified: trunk/libtry-tiny-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/MANIFEST?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/MANIFEST (original)
+++ trunk/libtry-tiny-perl/MANIFEST Thu May 27 00:32:03 2010
@@ -5,6 +5,7 @@
 MANIFEST.SKIP
 t/basic.t
 t/finally.t
+t/given_when.t
 t/when.t
 META.yml                                 Module meta-data (added by MakeMaker)
 SIGNATURE                                Public-key signature (added by MakeMaker)

Modified: trunk/libtry-tiny-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/META.yml?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/META.yml (original)
+++ trunk/libtry-tiny-perl/META.yml Thu May 27 00:32:03 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Try-Tiny
-version:            0.04
+version:            0.05
 abstract:           ~
 author:  []
 license:            unknown
@@ -15,7 +15,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.55_02
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/libtry-tiny-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/SIGNATURE?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/SIGNATURE (original)
+++ trunk/libtry-tiny-perl/SIGNATURE Thu May 27 00:32:03 2010
@@ -1,5 +1,5 @@
 This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.61.
+signed via the Module::Signature module, version 0.62.
 
 To verify the content in this distribution, first make sure you have
 Module::Signature installed, then type:
@@ -14,19 +14,20 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 6ac3ace209467c2102863c6b598da0f6d9cb019a Changes
-SHA1 ddef902deeadd5075a417ba50041f8ffc9ca8a5b MANIFEST
+SHA1 bfbe6619e1cd5d42527edbf54c3909f5942c5a65 Changes
+SHA1 e0d38faf7e10305aad82516b621327795e84a4d7 MANIFEST
 SHA1 606bd6424682249397d63caf905f651178a4d6cc MANIFEST.SKIP
-SHA1 1a2378a6084537f42285b7faed60da0aec42f952 META.yml
+SHA1 cbc736a21ff2b0fbd632485e88ac5bfac5e6bf82 META.yml
 SHA1 6adc37b24473f070c318abfe77a8531fbf1eefca Makefile.PL
-SHA1 d9d03f47653d6a711bf02869ea7a1572875641f7 lib/Try/Tiny.pm
+SHA1 e92f690cddf8fa15279e856211abee01240815c8 lib/Try/Tiny.pm
 SHA1 f87be39d1cb320cd0ac206143f59accdecf21814 t/basic.t
 SHA1 567bd02fb537a942cb00333bf6f31981c20532bb t/finally.t
+SHA1 903299b886421f92429a925f118756307da70d03 t/given_when.t
 SHA1 c75ffed79f4936105b81aa82443b0a0a87c78873 t/when.t
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG/MacGPG2 v2.0.12 (Darwin)
 
-iEYEARECAAYFAktaBXIACgkQVCwRwOvSdBhnggCgtF8boUpi3GEqoj1+MQf3vra9
-K/QAnjnS+6aScM4HHAx91kjWf7pUhl3L
-=jGZm
+iEYEARECAAYFAkv9GhIACgkQVCwRwOvSdBg7OgCfZvZuSeptGTfjIjr89KNeKwdg
+FQMAn1g6Kn+FtJfgThOJthRDAqkXQWJA
+=Jt/I
 -----END PGP SIGNATURE-----

Modified: trunk/libtry-tiny-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/debian/changelog?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/debian/changelog (original)
+++ trunk/libtry-tiny-perl/debian/changelog Thu May 27 00:32:03 2010
@@ -1,3 +1,12 @@
+libtry-tiny-perl (0.05-1) UNRELEASED; urgency=low
+
+  Documentation fixes only
+  IGNORE-VERSION: 0.05-1
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Wed, 26 May 2010 21:07:43 -0400
+
 libtry-tiny-perl (0.04-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libtry-tiny-perl/lib/Try/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtry-tiny-perl/lib/Try/Tiny.pm?rev=58490&op=diff
==============================================================================
--- trunk/libtry-tiny-perl/lib/Try/Tiny.pm (original)
+++ trunk/libtry-tiny-perl/lib/Try/Tiny.pm Thu May 27 00:32:03 2010
@@ -10,7 +10,7 @@
 	@ISA = qw(Exporter);
 }
 
-$VERSION = "0.04";
+$VERSION = "0.05";
 
 $VERSION = eval $VERSION;
 
@@ -148,7 +148,7 @@
 	try {
 		die "foo";
 	} catch {
-		warn "caught error: $_";
+		warn "caught error: $_"; # not $@
 	};
 
 	# just silence errors
@@ -217,6 +217,9 @@
 with the error in C<$_> (localized) and as that block's first and only
 argument.
 
+C<$@> does B<not> contain the error. Inside the C<catch> block it has the same
+value it had before the C<try> block was executed.
+
 Note that the error may be false, but if that happens the C<catch> block will
 still be invoked.
 
@@ -232,9 +235,15 @@
 
 	catch { ... }
 
-Inside the catch block the previous value of C<$@> is still available for use.
-This value may or may not be meaningful depending on what happened before the
-C<try>, but it might be a good idea to preserve it in an error stack.
+Inside the catch block the caught error is stored in C<$_>, while previous
+value of C<$@> is still available for use.  This value may or may not be
+meaningful depending on what happened before the C<try>, but it might be a good
+idea to preserve it in an error stack.
+
+For code that captures C<$@> when throwing new errors (i.e.
+L<Class::Throwable>), you'll need to do:
+
+	local $@ = $_;
 
 =item finally (&;$)
 
@@ -282,7 +291,7 @@
 C<$@> must be properly localized before invoking C<eval> in order to avoid this
 issue.
 
-More specifically, C<$@> is clobbered at the begining of the C<eval>, which
+More specifically, C<$@> is clobbered at the beginning of the C<eval>, which
 also makes it impossible to capture the previous error before you die (for
 instance when making exception objects with error stacks).
 
@@ -407,8 +416,8 @@
 =item *
 
 C<try> introduces another caller stack frame. L<Sub::Uplevel> is not used. L<Carp>
-will report this when using full stack traces. This lack of magic is considered
-a feature.
+will not report this when using full stack traces, though, because
+C<%Carp::Internal> is used. This lack of magic is considered a feature.
 
 =item *
 
@@ -433,6 +442,33 @@
 
 	return unless $obj;
 
+=item *
+
+C<$SIG{__DIE__}> is still in effect.
+
+Though it can be argued that C<$SIG{__DIE__}> should be disabled inside of
+C<eval> blocks, since it isn't people have grown to rely on it. Therefore in
+the interests of compatibility, C<try> does not disable C<$SIG{__DIE__}> for
+the scope of the error throwing code.
+
+=item *
+
+Lexical C<$_> may override the one set by C<catch>.
+
+For example Perl 5.10's C<given> form uses a lexical C<$_>, creating some
+confusing behavior:
+
+	given ($foo) {
+		when (...) {
+			try {
+				...
+			} catch {
+				warn $_; # will print $foo, not the error
+				warn $_[0]; # instead, get the error like this
+			}
+		}
+	}
+
 =back
 
 =head1 SEE ALSO
@@ -473,7 +509,7 @@
 I gave a lightning talk about this module, you can see the slides (Firefox
 only):
 
-L<http://nothingmuch.woobling.org/talks/takahashi.xul?data=try_tiny.txt>
+L<http://nothingmuch.woobling.org/talks/takahashi.xul?data=yapc_asia_2009/try_tiny.txt>
 
 Or read the source:
 




More information about the Pkg-perl-cvs-commits mailing list