r59664 - in /trunk/libcapture-tiny-perl: Changes MANIFEST META.yml README debian/changelog examples/rt-58208.pl lib/Capture/Tiny.pm lib/Capture/Tiny.pod t/16-catch-errors.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Mon Jun 21 19:51:53 UTC 2010


Author: gregoa
Date: Mon Jun 21 19:51:45 2010
New Revision: 59664

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59664
Log:
New upstream release.

Added:
    trunk/libcapture-tiny-perl/examples/rt-58208.pl
      - copied unchanged from r59663, branches/upstream/libcapture-tiny-perl/current/examples/rt-58208.pl
    trunk/libcapture-tiny-perl/t/16-catch-errors.t
      - copied unchanged from r59663, branches/upstream/libcapture-tiny-perl/current/t/16-catch-errors.t
Modified:
    trunk/libcapture-tiny-perl/Changes
    trunk/libcapture-tiny-perl/MANIFEST
    trunk/libcapture-tiny-perl/META.yml
    trunk/libcapture-tiny-perl/README
    trunk/libcapture-tiny-perl/debian/changelog
    trunk/libcapture-tiny-perl/lib/Capture/Tiny.pm
    trunk/libcapture-tiny-perl/lib/Capture/Tiny.pod

Modified: trunk/libcapture-tiny-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/Changes?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/Changes (original)
+++ trunk/libcapture-tiny-perl/Changes Mon Jun 21 19:51:45 2010
@@ -6,6 +6,13 @@
 # copy of the License from http://www.apache.org/licenses/LICENSE-2.0
 
 Revision history for Capture-Tiny
+
+0.08 Sun Jun 20 19:13:19 EDT 2010
+
+  Fixed:
+
+  - Exceptions in captured coderef are caught, then handles are restored
+    before the exception is rethrown (RT #58208)
 
 0.07 Sun Jan 24 00:18:45 EST 2010
 

Modified: trunk/libcapture-tiny-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/MANIFEST?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/MANIFEST (original)
+++ trunk/libcapture-tiny-perl/MANIFEST Mon Jun 21 19:51:45 2010
@@ -1,5 +1,6 @@
 Build.PL
 Changes
+examples/rt-58208.pl
 examples/tee.pl
 inc/Module/Build/WikiDoc.pm
 INSTALL
@@ -24,6 +25,7 @@
 t/13-stdout-tied.t
 t/14-stderr-tied.t
 t/15-stdin-tied.t
+t/16-catch-errors.t
 t/lib/Cases.pm
 t/lib/TieLC.pm
 t/lib/Utils.pm

Modified: trunk/libcapture-tiny-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/META.yml?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/META.yml (original)
+++ trunk/libcapture-tiny-perl/META.yml Mon Jun 21 19:51:45 2010
@@ -20,7 +20,7 @@
 provides:
   Capture::Tiny:
     file: lib/Capture/Tiny.pm
-    version: 0.07
+    version: 0.08
 requires:
   Exporter: 0
   File::Spec: 0
@@ -30,4 +30,4 @@
 resources:
   bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Capture-Tiny
   repository: http://github.com/dagolden/capture-tiny/
-version: 0.07
+version: 0.08

Modified: trunk/libcapture-tiny-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/README?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/README (original)
+++ trunk/libcapture-tiny-perl/README Mon Jun 21 19:51:45 2010
@@ -3,7 +3,7 @@
     programs
 
 VERSION
-    This documentation describes version 0.07.
+    This documentation describes version 0.08.
 
 SYNOPSIS
          use Capture::Tiny qw/capture tee capture_merged tee_merged/;
@@ -43,7 +43,7 @@
        ($stdout, $stderr) = capture \&code;
        $stdout = capture \&code;
 
-    The `capture' function takes a code reference and returns what is sent
+    The "capture" function takes a code reference and returns what is sent
     to STDOUT and STDERR. In scalar context, it returns only STDOUT. If no
     output was received, returns an empty string. Regardless of context, all
     output is captured -- nothing is passed to the existing handles.
@@ -58,10 +58,10 @@
   capture_merged
        $merged = capture_merged \&code;
 
-    The `capture_merged' function works just like `capture' except STDOUT
+    The "capture_merged" function works just like "capture" except STDOUT
     and STDERR are merged. (Technically, STDERR is redirected to STDOUT
     before executing the function.) If no output was received, returns an
-    empty string. As with `capture' it may be called in block form.
+    empty string. As with "capture" it may be called in block form.
 
     Caution: STDOUT and STDERR output in the merged result are not
     guaranteed to be properly ordered due to buffering.
@@ -70,15 +70,15 @@
        ($stdout, $stderr) = tee \&code;
        $stdout = tee \&code;
 
-    The `tee' function works just like `capture', except that output is
+    The "tee" function works just like "capture", except that output is
     captured as well as passed on to the original STDOUT and STDERR. As with
-    `capture' it may be called in block form.
+    "capture" it may be called in block form.
 
   tee_merged
        $merged = tee_merged \&code;
 
-    The `tee_merged' function works just like `capture_merged' except that
-    output is captured as well as passed on to STDOUT. As with `capture' it
+    The "tee_merged" function works just like "capture_merged" except that
+    output is captured as well as passed on to STDOUT. As with "capture" it
     may be called in block form.
 
     Caution: STDOUT and STDERR output in the merged result are not
@@ -86,14 +86,14 @@
 
 LIMITATIONS
   Portability
-    Portability is a goal, not a guarantee. `tee' requires fork, except on
-    Windows where `system(1, @cmd)' is used instead. Not tested on any
+    Portability is a goal, not a guarantee. "tee" requires fork, except on
+    Windows where "system(1, @cmd)" is used instead. Not tested on any
     particularly esoteric platforms yet.
 
   PerlIO layers
     Capture::Tiny does it's best to preserve PerlIO layers such as ':utf8'
     or ':crlf' when capturing. Layers should be applied to STDOUT or STDERR
-    *before* the call to `capture' or `tee'.
+    *before* the call to "capture" or "tee".
 
   Closed STDIN, STDOUT or STDERR
     Capture::Tiny will work even if STDIN, STDOUT or STDERR have been
@@ -105,8 +105,8 @@
 
   Scalar filehandles and STDIN, STDOUT or STDERR
     If STDOUT or STDERR are reopened to scalar filehandles prior to the call
-    to `capture' or `tee', then Capture::Tiny will override the output
-    handle for the duration of the `capture' or `tee' call and then send
+    to "capture" or "tee", then Capture::Tiny will override the output
+    handle for the duration of the "capture" or "tee" call and then send
     captured output to the output handle after the capture is complete.
     (Requires Perl 5.8)
 
@@ -114,9 +114,9 @@
     scalar reference.
 
   Tied STDIN, STDOUT or STDERR
-    If STDOUT or STDERR are tied prior to the call to `capture' or `tee',
+    If STDOUT or STDERR are tied prior to the call to "capture" or "tee",
     then Capture::Tiny will attempt to override the tie for the duration of
-    the `capture' or `tee' call and then send captured output to the tied
+    the "capture" or "tee" call and then send captured output to the tied
     handle after the capture is complete. (Requires Perl 5.8)
 
     Capture::Tiny does not (yet) support resending utf8 encoded data to a
@@ -126,7 +126,7 @@
     capturing or teeing when STDIN is tied is currently broken on Windows.
 
   Modifiying STDIN, STDOUT or STDERR during a capture
-    Attempting to modify STDIN, STDOUT or STDERR *during* `capture' or `tee'
+    Attempting to modify STDIN, STDOUT or STDERR *during* "capture" or "tee"
     is almost certainly going to cause problems. Don't do that.
 
   No support for Perl 5.8.0
@@ -135,7 +135,7 @@
 BUGS
     Please report any bugs or feature requests using the CPAN Request
     Tracker. Bugs can be submitted through the web interface at
-    http://rt.cpan.org/Dist/Display.html?Queue=Capture-Tiny
+    <http://rt.cpan.org/Dist/Display.html?Queue=Capture-Tiny>
 
     When submitting a bug or request, please include a test-file or a patch
     to an existing test-file that illustrates the bug or desired feature.
@@ -197,8 +197,7 @@
     Licensed under Apache License, Version 2.0 (the "License"). You may not
     use this file except in compliance with the License. A copy of the
     License was distributed with this file or you may obtain a copy of the
-    License from
-    http:E<sol>E<sol>www.apache.orgE<sol>licensesE<sol>LICENSE-2.0
+    License from http://www.apache.org/licenses/LICENSE-2.0
 
     Files produced as output though the use of this software, shall not be
     considered Derivative Works, but shall be considered the original work

Modified: trunk/libcapture-tiny-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/debian/changelog?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/debian/changelog (original)
+++ trunk/libcapture-tiny-perl/debian/changelog Mon Jun 21 19:51:45 2010
@@ -1,3 +1,9 @@
+libcapture-tiny-perl (0.08-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Mon, 21 Jun 2010 21:51:12 +0200
+
 libcapture-tiny-perl (0.07-1) unstable; urgency=low
 
   [ Jonathan Yu ]

Modified: trunk/libcapture-tiny-perl/lib/Capture/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/lib/Capture/Tiny.pm?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/lib/Capture/Tiny.pm (original)
+++ trunk/libcapture-tiny-perl/lib/Capture/Tiny.pm Mon Jun 21 19:51:45 2010
@@ -19,7 +19,7 @@
     or *PerlIO::get_layers = sub { return () };
 }
 
-our $VERSION = '0.07';
+our $VERSION = '0.08';
 $VERSION = eval $VERSION; ## no critic
 our @ISA = qw/Exporter/;
 our @EXPORT_OK = qw/capture capture_merged tee tee_merged/;
@@ -52,10 +52,10 @@
 sub _relayer {
   my ($fh, $layers) = @_;
   _debug("# requested layers (@{$layers}) to $fh\n");
-  my %seen;
-  my @unique = grep { $_ ne 'unix' and $_ ne 'perlio' and !$seen{$_}++ } @$layers;
+  my %seen = ( unix => 1, perlio => 1 ); # filter these out
+  my @unique = grep { !$seen{$_}++ } @$layers;
   _debug("# applying unique layers (@unique) to $fh\n");
-  binmode($fh, join(":", "", "raw", @unique));
+  binmode($fh, join(":", ":raw", @unique));
 }
 
 sub _name {
@@ -293,7 +293,7 @@
   _debug( "# redirecting in parent ...\n" );
   _open_std( $stash->{new} );
   # execute user provided code
-  my $exit_code;
+  my ($exit_code, $error);
   {
     local *STDIN = *CT_ORIG_STDIN if $localize{stdin}; # get original, not proxy STDIN
     local *STDERR = *STDOUT if $merge; # minimize buffer mixups during $code
@@ -301,8 +301,9 @@
     _relayer(\*STDOUT, $layers{stdout});
     _relayer(\*STDERR, $layers{stderr}) unless $merge;
     _debug( "# running code $code ...\n" );
-    $code->();
+    eval { $code->() };
     $exit_code = $?; # save this for later
+    $error = $@; # save this for later
   }
   # restore prior filehandles and shut down tees
   _debug( "# restoring ...\n" );
@@ -319,6 +320,7 @@
   print CT_ORIG_STDOUT $got_out if $localize{stdout} && $tee_stdout;
   print CT_ORIG_STDERR $got_err if !$merge && $localize{stderr} && $tee_stdout;
   $? = $exit_code;
+  die $error if $error;
   _debug( "# ending _capture_tee with (@_)...\n" );
   return $got_out if $merge;
   return wantarray ? ($got_out, $got_err) : $got_out;

Modified: trunk/libcapture-tiny-perl/lib/Capture/Tiny.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcapture-tiny-perl/lib/Capture/Tiny.pod?rev=59664&op=diff
==============================================================================
--- trunk/libcapture-tiny-perl/lib/Capture/Tiny.pod (original)
+++ trunk/libcapture-tiny-perl/lib/Capture/Tiny.pod Mon Jun 21 19:51:45 2010
@@ -8,7 +8,7 @@
 
 =head1 VERSION
 
-This documentation describes version 0.07.
+This documentation describes version 0.08.
 
 =head1 SYNOPSIS
 




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