r39327 - in /branches/upstream/libautodie-perl/current: Changes META.yml lib/Fatal.pm lib/autodie.pm lib/autodie/exception.pm lib/autodie/exception/system.pm lib/autodie/hints.pm t/open.t

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Sat Jul 4 14:52:46 UTC 2009


Author: angelabad-guest
Date: Sat Jul  4 14:52:40 2009
New Revision: 39327

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=39327
Log:
[svn-upgrade] Integrating new upstream version, libautodie-perl (2.05)

Modified:
    branches/upstream/libautodie-perl/current/Changes
    branches/upstream/libautodie-perl/current/META.yml
    branches/upstream/libautodie-perl/current/lib/Fatal.pm
    branches/upstream/libautodie-perl/current/lib/autodie.pm
    branches/upstream/libautodie-perl/current/lib/autodie/exception.pm
    branches/upstream/libautodie-perl/current/lib/autodie/exception/system.pm
    branches/upstream/libautodie-perl/current/lib/autodie/hints.pm
    branches/upstream/libautodie-perl/current/t/open.t

Modified: branches/upstream/libautodie-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/Changes?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/Changes (original)
+++ branches/upstream/libautodie-perl/current/Changes Sat Jul  4 14:52:40 2009
@@ -1,4 +1,15 @@
 Revision history for autodie
+
+        * BUGFIX: format_default() in autodie::exception no longer
+          returns a string with file and line attached.  This would
+          cause the file and line information to appear twice when
+          format handlers would choose to fall back to the defaults.
+          The file and line information is now always added by
+          stringify().  (RT #47520, thanks to Michael Schwern)
+
+        * BUGFIX: Exceptions thrown by 2-argument open() are more likely
+          to specify the mode as 'for reading' when no explicit
+          mode was given.  (RT #47520, thanks to Michael Schwern)
 
 2.04  Thu Jul  2 18:56:57 AUSEST 2009
 

Modified: branches/upstream/libautodie-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/META.yml?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/META.yml (original)
+++ branches/upstream/libautodie-perl/current/META.yml Sat Jul  4 14:52:40 2009
@@ -27,4 +27,4 @@
   bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie
   license: http://dev.perl.org/licenses/
   repository: http://github.com/pfenwick/autodie/tree/master
-version: 2.04
+version: 2.05

Modified: branches/upstream/libautodie-perl/current/lib/Fatal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/lib/Fatal.pm?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/lib/Fatal.pm (original)
+++ branches/upstream/libautodie-perl/current/lib/Fatal.pm Sat Jul  4 14:52:40 2009
@@ -39,7 +39,7 @@
 use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;
 
 # All the Fatal/autodie modules share the same version number.
-our $VERSION = '2.04';
+our $VERSION = '2.05';
 
 our $Debug ||= 0;
 
@@ -99,6 +99,7 @@
     ':2.02'  => [qw(:default)],
     ':2.03'  => [qw(:default)],
     ':2.04'  => [qw(:default)],
+    ':2.05'  => [qw(:default)],
 );
 
 $TAGS{':all'}  = [ keys %TAGS ];

Modified: branches/upstream/libautodie-perl/current/lib/autodie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/lib/autodie.pm?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/lib/autodie.pm (original)
+++ branches/upstream/libautodie-perl/current/lib/autodie.pm Sat Jul  4 14:52:40 2009
@@ -8,7 +8,7 @@
 our $VERSION;
 
 BEGIN {
-    $VERSION = '2.04';
+    $VERSION = '2.05';
 }
 
 use constant ERROR_WRONG_FATAL => q{

Modified: branches/upstream/libautodie-perl/current/lib/autodie/exception.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/lib/autodie/exception.pm?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/lib/autodie/exception.pm (original)
+++ branches/upstream/libautodie-perl/current/lib/autodie/exception.pm Sat Jul  4 14:52:40 2009
@@ -14,7 +14,7 @@
 
 use if ($] >= 5.010), overload => '~~'  => "matches";
 
-our $VERSION = '2.04';
+our $VERSION = '2.05';
 
 my $PACKAGE = __PACKAGE__;  # Useful to have a scalar for hash keys.
 
@@ -417,8 +417,20 @@
             [^&]                # Not an ampersand (which means a dup)
         }x;
 
-        # Have a funny mode?  Use the default format.
-        return $this->format_default if not defined $mode;
+        if (not $mode) {
+            # Maybe it's a 2-arg open without any mode at all?
+            # Detect the most simple case for this, where our
+            # file consists only of word characters.
+
+            if ( $file =~ m{^\s*\w+\s*$} ) {
+                $mode = '<'
+            }
+            else {
+                # Otherwise, we've got no idea what's going on.
+                # Use the default.
+                return $this->format_default;
+            }
+        }
 
         # Localising $! means perl make make it a pretty error for us.
         local $! = $this->errno;
@@ -517,7 +529,7 @@
         return $sub->($this) . $this->add_file_and_line;
     }
 
-    return $this->format_default;
+    return $this->format_default . $this->add_file_and_line;
 
 }
 
@@ -568,8 +580,7 @@
 
     # Format our beautiful error.
 
-    return "Can't $call(".  join(q{, }, @args) . "): $!" .
-        $this->add_file_and_line;
+    return "Can't $call(".  join(q{, }, @args) . "): $!" ;
 
     # TODO - Handle user-defined errors from hash.
 

Modified: branches/upstream/libautodie-perl/current/lib/autodie/exception/system.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/lib/autodie/exception/system.pm?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/lib/autodie/exception/system.pm (original)
+++ branches/upstream/libautodie-perl/current/lib/autodie/exception/system.pm Sat Jul  4 14:52:40 2009
@@ -5,7 +5,7 @@
 use base 'autodie::exception';
 use Carp qw(croak);
 
-our $VERSION = '2.04';
+our $VERSION = '2.05';
 
 my $PACKAGE = __PACKAGE__;
 

Modified: branches/upstream/libautodie-perl/current/lib/autodie/hints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/lib/autodie/hints.pm?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/lib/autodie/hints.pm (original)
+++ branches/upstream/libautodie-perl/current/lib/autodie/hints.pm Sat Jul  4 14:52:40 2009
@@ -5,7 +5,7 @@
 
 use constant PERL58 => ( $] < 5.009 );
 
-our $VERSION = '2.04';
+our $VERSION = '2.05';
 
 =head1 NAME
 

Modified: branches/upstream/libautodie-perl/current/t/open.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libautodie-perl/current/t/open.t?rev=39327&op=diff
==============================================================================
--- branches/upstream/libautodie-perl/current/t/open.t (original)
+++ branches/upstream/libautodie-perl/current/t/open.t Sat Jul  4 14:52:40 2009
@@ -16,3 +16,34 @@
 
 like($@, qr/for reading/, "Well-formatted 2-arg open failure");
 unlike($@, qr/GLOB\(0x/, "No ugly globs in 2-arg open messsage");
+
+# RT 47520.  2-argument open without mode would repeat the file
+# and line number.
+
+eval {
+    use autodie;
+
+    open(my $fh, NO_SUCH_FILE);
+};
+
+isa_ok($@, 'autodie::exception');
+like(  $@, qr/at \S+ line \d+/, "At least one mention");
+unlike($@, qr/at \S+ line \d+\s+at \S+ line \d+/, "...but not too mentions");
+
+# RT 47520-ish.  2-argument open without a mode should be marked
+# as 'for reading'.
+like($@, qr/for reading/, "Well formatted 2-arg open without mode");
+
+# We also shouldn't get repeated messages, even if the default mode
+# was used.  Single-arg open always falls through to the default
+# formatter.
+
+eval {
+    use autodie;
+
+    open( NO_SUCH_FILE . "" );
+};
+
+isa_ok($@, 'autodie::exception');
+like(  $@, qr/at \S+ line \d+/, "At least one mention");
+unlike($@, qr/at \S+ line \d+\s+at \S+ line \d+/, "...but not too mentions");




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