New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double non-numeric warning in range #13268
Comments
From @cpansprout$ ./perl -Ilib -we '()=*foo..3' Flags: Site configuration information for perl 5.19.4: Configured by sprout at Mon Sep 9 00:16:24 PDT 2013. Summary of my perl5 (revision 5 version 19 subversion 4) configuration: @INC for perl 5.19.4: Environment for perl 5.19.4: |
From @jkeenanOn Sun Sep 15 13:40:08 2013, sprout wrote:
As the patch attached shows, this problem seems to occur only on the command-line -- not in a program in a file. -- |
From @jkeenan119819-do-not-apply.diffdiff --git a/t/op/range.t b/t/op/range.t
index 7809882..c0eef4d 100644
--- a/t/op/range.t
+++ b/t/op/range.t
@@ -9,7 +9,7 @@ require './test.pl';
use Config;
-plan (141);
+plan (142);
is(join(':',1..5), '1:2:3:4:5');
@@ -403,4 +403,17 @@ is( ( join ' ', map { join '', map ++$_, 'a'..'d' } 1..2 ), 'bcde bcde',
$s = ''; for (1..2) { for ('a'..'d') { $s .= ++$_ } $s.=' ' if $_==1; }
is( $s, 'bcde bcde','modifiable alpha counting loop counter' );
+{
+ # test non-numeric warning in range (RT #119819)
+ my $msg = '';
+ local $SIG{__WARN__} = sub { $msg = $_[0] };
+ use warnings;
+ () = *foo..3;
+ like($msg,
+ qr/Argument "\*main::foo" isn't numeric in range \(or flop\)/,
+ "Got expected message about non-numeric argument in range"
+ );
+# print STDERR "<$msg>";
+}
+
# EOF
|
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Wed Dec 03 18:53:35 2014, jkeenan wrote:
Your test isn’t counting how many times the warning occurs. -- Father Chrysostomos |
From @jkeenanOn Wed Dec 03 21:47:13 2014, sprout wrote:
But if you uncomment the line beginning with 'print STDERR' and run this as you normally would for an individual file in the Perl 5 test suite, you will only get one instance of the warning. ##### ##### My point was that the problem originally described is, for some reason which I don't understand, only a command-line problem. Thank you very much. |
From @cpansproutOn Mon Dec 08 17:52:18 2014, jkeenan wrote:
Try applying the attached on top of your patch. You will see that $SIG{__WARN__} is firing twice. -- Father Chrysostomos |
From @cpansproutInline Patchdiff --git a/t/op/range.t b/t/op/range.t
index 99eb2a6..ab554e7 100644
--- a/t/op/range.t
+++ b/t/op/range.t
@@ -398,7 +398,7 @@ is( $s, '2345 2345','modifiable num counting loop counter' );
{
# test non-numeric warning in range (RT #119819)
my $msg = '';
- local $SIG{__WARN__} = sub { $msg = $_[0] };
+ local $SIG{__WARN__} = sub { print STDERR "warning!\n"; $msg .= $_[0] };
use warnings;
() = *foo..3;
like($msg, |
Migrated from rt.perl.org#119819 (status was 'open')
Searchable as RT119819$
The text was updated successfully, but these errors were encountered: