r26650 - in /branches/upstream/libexception-class-trycatch-perl/current: Changes META.yml README lib/Exception/Class/TryCatch.pm lib/Exception/Class/TryCatch.pod t/01_Exception_Class_TryCatch.t
ghostbar-guest at users.alioth.debian.org
ghostbar-guest at users.alioth.debian.org
Tue Nov 4 05:05:03 UTC 2008
Author: ghostbar-guest
Date: Tue Nov 4 05:04:59 2008
New Revision: 26650
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26650
Log:
[svn-upgrade] Integrating new upstream version, libexception-class-trycatch-perl (1.12)
Modified:
branches/upstream/libexception-class-trycatch-perl/current/Changes
branches/upstream/libexception-class-trycatch-perl/current/META.yml
branches/upstream/libexception-class-trycatch-perl/current/README
branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pm
branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pod
branches/upstream/libexception-class-trycatch-perl/current/t/01_Exception_Class_TryCatch.t
Modified: branches/upstream/libexception-class-trycatch-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/Changes?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/Changes (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/Changes Tue Nov 4 05:04:59 2008
@@ -1,4 +1,9 @@
Revision history for Perl module Exception::Class::TryCatch
+
+1.12 Mon Nov 3 17:12:19 EST 2008
+
+ - Changed: if no exception was thrown, catch() returns an empty array
+ in list context
1.11 Tue Sep 30 12:21:56 EDT 2008
Modified: branches/upstream/libexception-class-trycatch-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/META.yml?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/META.yml (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/META.yml Tue Nov 4 05:04:59 2008
@@ -1,6 +1,6 @@
---
name: Exception-Class-TryCatch
-version: 1.11
+version: 1.12
author:
- 'David Golden <dagolden at cpan.org>'
abstract: Syntactic tryE<sol>catch sugar for use with Exception::Class
@@ -15,7 +15,7 @@
provides:
Exception::Class::TryCatch:
file: lib/Exception/Class/TryCatch.pm
- version: 1.11
+ version: 1.12
generated_by: Module::Build version 0.3
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
Modified: branches/upstream/libexception-class-trycatch-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/README?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/README (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/README Tue Nov 4 05:04:59 2008
@@ -3,7 +3,7 @@
Exception::Class
VERSION
- This documentation describes version 1.11.
+ This documentation describes version 1.12.
SYNOPSIS
use Exception::Class::TryCatch;
@@ -80,10 +80,11 @@
catch my $err, [ 'Exception::Type', 'Exception::Other::Type' ];
Returns an "Exception::Class::Base" object (or an object which is a
- subclass of it) if an exception has been caught by "eval" or else
- returns "undef" if no error exists. The exception is either popped from
- a hidden error stack (see "try") or, if the stack is empty, taken from
- the current value of $@.
+ subclass of it) if an exception has been caught by "eval". If no
+ exception was thrown, it returns "undef" in scalar context and an empty
+ list in list context. The exception is either popped from a hidden error
+ stack (see "try") or, if the stack is empty, taken from the current
+ value of $@.
If the exception is not an "Exception::Class::Base" object (or subclass
object), an "Exception::Class::Base" object will be created using the
Modified: branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pm?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pm (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pm Tue Nov 4 05:04:59 2008
@@ -6,7 +6,7 @@
package Exception::Class::TryCatch;
-$VERSION = '1.11';
+$VERSION = '1.12';
@ISA = qw (Exporter);
@EXPORT = qw ( catch try );
@EXPORT_OK = qw ( caught );
@@ -45,7 +45,7 @@
$e->rethrow() unless grep { $e->isa($_) } @{$_[0]};
}
}
- return $e;
+ return wantarray ? ( $e ? ($e) : () ) : $e;
}
*caught = \&catch;
@@ -151,11 +151,11 @@
# two argument form
catch my $err, [ 'Exception::Type', 'Exception::Other::Type' ];
-Returns an {Exception::Class::Base} object (or an object which is a
-subclass of it) if an exception has been caught by {eval} or else
-returns {undef} if no error exists. The exception is either popped
-from a hidden error stack (see {try}) or, if the stack is empty, taken from
-the current value of {$@}.
+Returns an {Exception::Class::Base} object (or an object which is a subclass of
+it) if an exception has been caught by {eval}. If no exception was thrown, it
+returns {undef} in scalar context and an empty list in list context. The
+exception is either popped from a hidden error stack (see {try}) or, if the
+stack is empty, taken from the current value of {$@}.
If the exception is not an {Exception::Class::Base} object (or subclass
object), an {Exception::Class::Base} object will be created using the string
Modified: branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pod?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pod (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/lib/Exception/Class/TryCatch.pod Tue Nov 4 05:04:59 2008
@@ -8,7 +8,7 @@
=head1 VERSION
-This documentation describes version 1.11.
+This documentation describes version 1.12.
=head1 SYNOPSIS
@@ -86,11 +86,11 @@
# two argument form
catch my $err, [ 'Exception::Type', 'Exception::Other::Type' ];
-Returns an C<<< Exception::Class::Base >>> object (or an object which is a
-subclass of it) if an exception has been caught by C<<< eval >>> or else
-returns C<<< undef >>> if no error exists. The exception is either popped
-from a hidden error stack (see C<<< try >>>) or, if the stack is empty, taken from
-the current value of C<<< $@ >>>.
+Returns an C<<< Exception::Class::Base >>> object (or an object which is a subclass of
+it) if an exception has been caught by C<<< eval >>>. If no exception was thrown, it
+returns C<<< undef >>> in scalar context and an empty list in list context. The
+exception is either popped from a hidden error stack (see C<<< try >>>) or, if the
+stack is empty, taken from the current value of C<<< $@ >>>.
If the exception is not an C<<< Exception::Class::Base >>> object (or subclass
object), an C<<< Exception::Class::Base >>> object will be created using the string
Modified: branches/upstream/libexception-class-trycatch-perl/current/t/01_Exception_Class_TryCatch.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-class-trycatch-perl/current/t/01_Exception_Class_TryCatch.t?rev=26650&op=diff
==============================================================================
--- branches/upstream/libexception-class-trycatch-perl/current/t/01_Exception_Class_TryCatch.t (original)
+++ branches/upstream/libexception-class-trycatch-perl/current/t/01_Exception_Class_TryCatch.t Tue Nov 4 05:04:59 2008
@@ -1,7 +1,7 @@
# Exception::Class::TryCatch
use strict;
-use Test::More tests => 42 ;
+use Test::More tests => 45 ;
use Exception::Class::TryCatch qw( try catch caught );
use Exception::Class 'My::Exception::Class', 'My::Other::Exception';
@@ -126,6 +126,23 @@
catch $err;
is ( $rv, undef, "try gets undef on exception" );
is ( $err->error, 'error', "simple try/catch works" );
+
+#--------------------------------------------------------------------------#
+# Test try/catch to array
+#--------------------------------------------------------------------------#
+
+$rv = try eval { My::Exception::Class->throw( "error" ) };
+my @err = catch;
+is ( scalar @err, 1, '@array = catch' );
+is ( $err[0]->error, 'error', 'array catch works' );
+
+#--------------------------------------------------------------------------#
+# Test try/catch to array -- no error
+#--------------------------------------------------------------------------#
+
+$rv = try eval { 42 };
+ at err = catch;
+is ( scalar @err, 0, 'array catch with no error returns empty array' );
#--------------------------------------------------------------------------#
# Test multiple try/catch with double error
More information about the Pkg-perl-cvs-commits
mailing list