diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-02-03 23:32:32 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-02-03 23:32:32 -0800 |
commit | 141c2cada6c8bc0ed7ed36f1c48ed8f99d0f0c27 (patch) | |
tree | 1a70d49bb77a50e75073e619fd54944a9f0a50d7 /ext | |
parent | becd10489a5ee10009a344e976dd06aa18ff13be (diff) | |
download | perl-141c2cada6c8bc0ed7ed36f1c48ed8f99d0f0c27.tar.gz |
Remove ‘Useless use of "re" pragma’ warning
It’s wrong.
$ ./perl -Ilib -le 'use re; print re::regmust(qr/foo/)'
Useless use of "re" pragma at -e line 1.
foo
Useless, eh? OK, then:
$ ./perl -Ilib -le 'print re::regmust(qr/foo/)'
Undefined subroutine &re::regmust called at -e line 1.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/re/re.pm | 4 | ||||
-rw-r--r-- | ext/re/t/re.t | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ext/re/re.pm b/ext/re/re.pm index 223a4cdccb..911112922e 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -108,10 +108,6 @@ sub _load_unload { sub bits { my $on = shift; my $bits = 0; - unless (@_) { - require Carp; - Carp::carp("Useless use of \"re\" pragma"); - } ARG: foreach my $idx (0..$#_){ my $s=$_[$idx]; diff --git a/ext/re/t/re.t b/ext/re/t/re.t index 8e06ef5172..5fbf3fd27e 100644 --- a/ext/re/t/re.t +++ b/ext/re/t/re.t @@ -10,7 +10,7 @@ BEGIN { use strict; -use Test::More tests => 13; +use Test::More tests => 14; require_ok( 're' ); # setcolor @@ -72,3 +72,12 @@ sub Tgetent { sub Tputs { return $_[1]; } + +package main; + +{ + my $w; + local $SIG{__WARN__} = sub { warn shift; ++$w }; + re->import(); + is $w, undef, 'no warning for "use re;" (which is not useless)'; +} |