In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/8b56d6ffd0fe641abae5662a8e75424a1d9e4dce?hp=97b33cac18e30b878b151b5f3fcbf9c32cb7b037>

- Log -----------------------------------------------------------------
commit 8b56d6ffd0fe641abae5662a8e75424a1d9e4dce
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Nov 13 10:19:59 2009 +0100

    [perl #70337] perldiag: localtime(...) too large
    
    The message ‘localtime(...) too large’ is not documented in perldiag.
    The attached patch adds it. I know it’s technically ‘%s(%.0f) too
    large’, but it’s easier for users to find it under ‘localtime’ and
    ‘gmtime’. I also had to modify diagnostics.pm to support %.0f, and I
    added a test, but I used a hack with STDERR that would make debugging
    very difficult to anyone else adding tests.
-----------------------------------------------------------------------

Summary of changes:
 lib/diagnostics.pm |    6 +++---
 lib/diagnostics.t  |    9 ++++++++-
 pod/perldiag.pod   |   11 +++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index 7af5efa..d65df19 100644
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -185,7 +185,7 @@ use 5.009001;
 use Carp;
 $Carp::Internal{__PACKAGE__.""}++;
 
-our $VERSION = 1.17;
+our $VERSION = '1.18';
 our $DEBUG;
 our $VERBOSE;
 our $PRETTY;
@@ -377,7 +377,7 @@ my %msg;
        # strip formatting directives from =item line
        $header =~ s/[A-Z]<(.*?)>/$1/g;
 
-        my @toks = split( /(%l?[dx]|%c|%(?:\.\d+)?s)/, $header );
+        my @toks = split( /(%l?[dx]|%c|%(?:\.\d+)?[fs])/, $header );
        if (@toks > 1) {
             my $conlen = 0;
             for my $i (0..$#toks){
@@ -386,7 +386,7 @@ my %msg;
                         $toks[$i] = '.';
                     } elsif( $toks[$i] eq '%d' ){
                         $toks[$i] = '\d+';
-                    } elsif( $toks[$i] eq '%s' ){
+                    } elsif( $toks[$i] =~ '^%(?:s|.*f)$' ){
                         $toks[$i] = $i == $#toks ? '.*' : '.*?';
                     } elsif( $toks[$i] =~ '%.(\d+)s' ){
                         $toks[$i] = ".{$1}";
diff --git a/lib/diagnostics.t b/lib/diagnostics.t
index f30f70e..ee0c160 100644
--- a/lib/diagnostics.t
+++ b/lib/diagnostics.t
@@ -5,7 +5,7 @@ BEGIN {
     @INC = 'lib';
 }
 
-use Test::More tests => 2;
+use Test::More tests => 3;
 
 BEGIN { use_ok('diagnostics') }
 
@@ -16,3 +16,10 @@ eval {
 };
 
 like( $@, qr/^Base class package "I::do::not::exist" is empty/);
+
+# Test for %.0f patterns in perldiag, added in 5.11.0
+close STDERR;
+open STDERR, ">", \my $warning
+    or die "Couldn't redirect STDERR to var: $!";
+warn('gmtime(nan) too large');
+like $warning, qr/\(W overflow\) You called/, '%0.f patterns';
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index db9a17c..d38244e 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1842,6 +1842,12 @@ a term, so it's looking for the corresponding right 
angle bracket, and
 not finding it.  Chances are you left some needed parentheses out
 earlier in the line, and you really meant a "less than".
 
+=item gmtime(%.0f) too large
+
+(W overflow) You called C<gmtime> with an number that was beyond the 64-bit
+range that it accepts, and some rounding resulted. This warning is also
+triggered with nan (the special not-a-number value).
+
 =item Got an error from DosAllocMem
 
 (P) An error peculiar to OS/2.  Most probably you're using an obsolete
@@ -2260,6 +2266,11 @@ an undefined value for the length. See L<perlfunc/pack>.
 to check the return value of your socket() call?  See
 L<perlfunc/listen>.
 
+=item localtime(%.0f) too large
+
+(W overflow) You called C<localtime> with an number that was beyond the
+64-bit range that it accepts, and some rounding resulted. This warning is also 
triggered with nan (the special not-a-number value).
+
 =item Lookbehind longer than %d not implemented in regex m/%s/
 
 (F) There is currently a limit on the length of string which lookbehind can

--
Perl5 Master Repository

Reply via email to