From: Vincent Pit Date: Sat, 5 Mar 2011 23:28:42 +0000 (+0100) Subject: Switch to qw<> X-Git-Tag: v0.15~7 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=daa5478303f254eff6015045396920baafee0688;p=perl%2Fmodules%2FScope-Upper.git Switch to qw<> --- diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index 6bce12a..63ca3bf 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -24,7 +24,7 @@ L, L, L, L and L : package Scope; - use Scope::Upper qw/reap localize localize_elem localize_delete :words/; + use Scope::Upper qw; sub new { my ($class, $name) = @_; @@ -87,7 +87,7 @@ L and L : package Try; - use Scope::Upper qw/unwind want_at :words/; + use Scope::Upper qw; sub try (&) { my @result = shift->(); @@ -99,14 +99,14 @@ L and L : sub zap { try { - my @things = qw/a b c/; + my @things = qw; return @things; # returns to try() and then outside zap() # not reached }; # not reached } - my @stuff = zap(); # @stuff contains qw/a b c/ + my @stuff = zap(); # @stuff contains qw my $stuff = zap(); # $stuff contains 3 =head1 DESCRIPTION @@ -380,13 +380,13 @@ Same goes for the words L, L, L, L, L, L =cut -use base qw/Exporter/; +use base qw; our @EXPORT = (); our %EXPORT_TAGS = ( - funcs => [ qw/reap localize localize_elem localize_delete unwind want_at/ ], - words => [ qw/TOP HERE UP SUB EVAL SCOPE CALLER/ ], - consts => [ qw/SU_THREADSAFE/ ], + funcs => [ qw ], + words => [ qw ], + consts => [ qw ], ); our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; diff --git a/samples/tag.pl b/samples/tag.pl index c414c07..0e39930 100644 --- a/samples/tag.pl +++ b/samples/tag.pl @@ -7,7 +7,7 @@ use blib; package Scope; -use Scope::Upper qw/reap localize localize_elem localize_delete :words/; +use Scope::Upper qw; sub new { my ($class, $name) = @_; diff --git a/samples/try.pl b/samples/try.pl index 7e1cb2a..e207e14 100644 --- a/samples/try.pl +++ b/samples/try.pl @@ -5,7 +5,7 @@ use warnings; use blib; -use Scope::Upper qw/unwind want_at :words/; +use Scope::Upper qw; sub try (&) { my @result = shift->(); @@ -15,13 +15,13 @@ sub try (&) { sub zap { try { - my @things = qw/a b c/; + my @things = qw; return @things; # returns to try() and then outside zap() }; print "NOT REACHED\n"; } -my @stuff = zap(); # @stuff contains qw/a b c/ +my @stuff = zap(); # @stuff contains qw my $stuff = zap(); # $stuff contains 3 print "zap() returns @stuff in list context and $stuff in scalar context\n"; diff --git a/t/05-words.t b/t/05-words.t index 1141a58..bcb3ac9 100644 --- a/t/05-words.t +++ b/t/05-words.t @@ -13,7 +13,7 @@ BEGIN { } } -use Scope::Upper qw/:words/; +use Scope::Upper qw<:words>; # This test is for internal use only and doesn't imply any kind of future # compatibility on what the words should actually return. diff --git a/t/06-want_at.t b/t/06-want_at.t index 8262255..12df3f0 100644 --- a/t/06-want_at.t +++ b/t/06-want_at.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 19; -use Scope::Upper qw/want_at UP HERE/; +use Scope::Upper qw; sub check { my ($w, $exp, $desc) = @_; diff --git a/t/11-reap-level.t b/t/11-reap-level.t index 873e901..d5f639e 100644 --- a/t/11-reap-level.t +++ b/t/11-reap-level.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/reap UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/12-reap-block.t b/t/12-reap-block.t index f8c8585..a4e3d17 100644 --- a/t/12-reap-block.t +++ b/t/12-reap-block.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/reap UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/13-reap-ctl.t b/t/13-reap-ctl.t index 39a0bb4..3f5db2b 100644 --- a/t/13-reap-ctl.t +++ b/t/13-reap-ctl.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 41 + 30 + 4 * 7; -use Scope::Upper qw/reap UP HERE/; +use Scope::Upper qw; our ($x, $y); diff --git a/t/15-reap-multi.t b/t/15-reap-multi.t index 7fe8195..4c41089 100644 --- a/t/15-reap-multi.t +++ b/t/15-reap-multi.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 8 + 18 + 4 + 8 + 11 + 5 + 17; -use Scope::Upper qw/reap UP HERE/; +use Scope::Upper qw; my $x; diff --git a/t/16-reap-numerous.t b/t/16-reap-numerous.t index d876e07..f130b68 100644 --- a/t/16-reap-numerous.t +++ b/t/16-reap-numerous.t @@ -8,7 +8,7 @@ BEGIN { $n = 1000; } use Test::More tests => $n; -use Scope::Upper qw/reap UP/; +use Scope::Upper qw; my $count; diff --git a/t/20-localize-target.t b/t/20-localize-target.t index ba77ea8..c352456 100644 --- a/t/20-localize-target.t +++ b/t/20-localize-target.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 70 + 4; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; # Scalars diff --git a/t/21-localize-level.t b/t/21-localize-level.t index 35a6600..c1dcabc 100644 --- a/t/21-localize-level.t +++ b/t/21-localize-level.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/22-localize-block.t b/t/22-localize-block.t index a41fcd0..ea189d8 100644 --- a/t/22-localize-block.t +++ b/t/22-localize-block.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/23-localize-ctl.t b/t/23-localize-ctl.t index 13fb193..0bd3563 100644 --- a/t/23-localize-ctl.t +++ b/t/23-localize-ctl.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 44 + 30; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; our ($x, $y); diff --git a/t/24-localize-magic.t b/t/24-localize-magic.t index 3bcb423..9dc6a32 100644 --- a/t/24-localize-magic.t +++ b/t/24-localize-magic.t @@ -3,11 +3,11 @@ use strict; use warnings; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; use Test::More tests => 5; -my @a = qw/a b c/; +my @a = qw; { local $" = ''; diff --git a/t/25-localize-multi.t b/t/25-localize-multi.t index e696b54..9ccd8f8 100644 --- a/t/25-localize-multi.t +++ b/t/25-localize-multi.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 10 + 5 + 6; -use Scope::Upper qw/localize UP HERE/; +use Scope::Upper qw; our $x; diff --git a/t/26-localize-numerous.t b/t/26-localize-numerous.t index a33a4e0..65e115a 100644 --- a/t/26-localize-numerous.t +++ b/t/26-localize-numerous.t @@ -8,7 +8,7 @@ BEGIN { $n = 1000; } use Test::More tests => 3; -use Scope::Upper qw/localize UP/; +use Scope::Upper qw; our $x = 0; our $z = $n; diff --git a/t/30-localize_elem-target.t b/t/30-localize_elem-target.t index 1e6e975..878670f 100644 --- a/t/30-localize_elem-target.t +++ b/t/30-localize_elem-target.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 25 + 12; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; # Arrays diff --git a/t/31-localize_elem-level.t b/t/31-localize_elem-level.t index 056ec6e..790147f 100644 --- a/t/31-localize_elem-level.t +++ b/t/31-localize_elem-level.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/32-localize_elem-block.t b/t/32-localize_elem-block.t index ec9fb9f..a1f4d47 100644 --- a/t/32-localize_elem-block.t +++ b/t/32-localize_elem-block.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/34-localize_elem-magic.t b/t/34-localize_elem-magic.t index 361f77d..307db88 100644 --- a/t/34-localize_elem-magic.t +++ b/t/34-localize_elem-magic.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; use Test::More tests => 8; diff --git a/t/36-localize_elem-numerous.t b/t/36-localize_elem-numerous.t index 95247d8..31cc1b7 100644 --- a/t/36-localize_elem-numerous.t +++ b/t/36-localize_elem-numerous.t @@ -8,7 +8,7 @@ BEGIN { $n = 1000; } use Test::More tests => 3; -use Scope::Upper qw/localize_elem UP/; +use Scope::Upper qw; our @A = ((0) x $n); diff --git a/t/40-localize_delete-target.t b/t/40-localize_delete-target.t index 044ca60..26a8195 100644 --- a/t/40-localize_delete-target.t +++ b/t/40-localize_delete-target.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 53 + 4; -use Scope::Upper qw/localize_delete UP HERE/; +use Scope::Upper qw; # Arrays diff --git a/t/41-localize_delete-level.t b/t/41-localize_delete-level.t index e3462fc..b00386d 100644 --- a/t/41-localize_delete-level.t +++ b/t/41-localize_delete-level.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize_delete UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/44-localize_delete-magic.t b/t/44-localize_delete-magic.t index bf0c43d..1a62829 100644 --- a/t/44-localize_delete-magic.t +++ b/t/44-localize_delete-magic.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Scope::Upper qw/localize_delete UP HERE/; +use Scope::Upper qw; use Test::More tests => 9; diff --git a/t/46-localize_delete-numerous.t b/t/46-localize_delete-numerous.t index 183dadc..e468acd 100644 --- a/t/46-localize_delete-numerous.t +++ b/t/46-localize_delete-numerous.t @@ -8,7 +8,7 @@ BEGIN { $n = 1000; } use Test::More tests => 3; -use Scope::Upper qw/localize_delete UP/; +use Scope::Upper qw; our @A = (1 .. $n); diff --git a/t/50-unwind-target.t b/t/50-unwind-target.t index 4304240..3c7a21d 100644 --- a/t/50-unwind-target.t +++ b/t/50-unwind-target.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 4; -use Scope::Upper qw/unwind/; +use Scope::Upper qw; my @res; diff --git a/t/55-unwind-multi.t b/t/55-unwind-multi.t index dd8c727..59c869c 100644 --- a/t/55-unwind-multi.t +++ b/t/55-unwind-multi.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 13; -use Scope::Upper qw/unwind SCOPE/; +use Scope::Upper qw; my ($l1, $l2); @@ -46,20 +46,20 @@ is_deeply [ a() ], [ 1 .. 12, 'in c', 'in b', 'in a' ], $l1 = 0; $l2 = 1; -is_deeply [ a() ], [ 1 .. 12, qw/eval from the sub c/, 'in b', 'in a' ], +is_deeply [ a() ], [ 1 .. 12, qw, 'in b', 'in a' ], 'l1=0, l2=1'; $l1 = 0; $l2 = 2; -is_deeply [ a() ], [ qw/eval from the sub c/, 'in a' ], +is_deeply [ a() ], [ qw, 'in a' ], 'l1=0, l2=2'; $l1 = 4; $l2 = 999; -is_deeply [ a() ], [ 1 .. 12, qw/from the sub c/, 'in b', 'in a' ], +is_deeply [ a() ], [ 1 .. 12, qw, 'in b', 'in a' ], 'l1=4, l2=?'; $l1 = 5; $l2 = 999; -is_deeply [ a() ], [ qw/from the sub c/, 'in a' ], +is_deeply [ a() ], [ qw, 'in a' ], 'l1=5, l2=?'; diff --git a/t/56-unwind-context.t b/t/56-unwind-context.t index 2973364..2779c9d 100644 --- a/t/56-unwind-context.t +++ b/t/56-unwind-context.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 33; -use Scope::Upper qw/unwind SUB/; +use Scope::Upper qw; my ($res, @res); @@ -13,7 +13,7 @@ my ($res, @res); sub { $res = 1; - unwind(qw/a b c/ => SUB); + unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in void context at sub to void'; @@ -21,7 +21,7 @@ ok $res, 'unwind in void context at sub to void'; sub { $res = 1; eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -30,7 +30,7 @@ ok $res, 'unwind in void context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } $res = 0; }->(0); @@ -39,14 +39,14 @@ ok $res, 'unwind in void context at sub across loop to void'; # --- Void to scalar ---------------------------------------------------------- $res = sub { - unwind(qw/a b c/ => SUB); + unwind(qw => SUB); return 'XXX'; }->(0); is $res, 'c', 'unwind in void context at sub to scalar'; $res = sub { eval { - unwind qw/d e f/ => SUB; + unwind qw => SUB; }; return 'XXX'; }->(0); @@ -54,13 +54,13 @@ is $res, 'f', 'unwind in void context at sub across eval to scalar'; $res = sub { for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } }->(0); is $res, 'i', 'unwind in void context at sub across loop to scalar'; $res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { $res = 'NO'; } return 'XXX'; @@ -70,31 +70,31 @@ is $res, 'l', 'unwind in void context at sub across loop iterator to scalar'; # --- Void to list ------------------------------------------------------------ @res = sub { - unwind qw/a b c/ => SUB; + unwind qw => SUB; return 'XXX'; }->(0); -is_deeply \@res, [ qw/a b c/ ], 'unwind in void context at sub to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub to list'; @res = sub { eval { - unwind qw/d e f/ => SUB; + unwind qw => SUB; }; return 'XXX'; }->(0); -is_deeply \@res, [ qw/d e f/ ], 'unwind in void context at sub across eval to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub across eval to list'; @res = sub { for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } }->(0); -is_deeply \@res, [ qw/g h i/ ], 'unwind in void context at sub across loop to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub across loop to list'; # --- Scalar to void ---------------------------------------------------------- sub { $res = 1; - my $temp = unwind(qw/a b c/ => SUB); + my $temp = unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in scalar context at sub to void'; @@ -102,7 +102,7 @@ ok $res, 'unwind in scalar context at sub to void'; sub { $res = 1; my $temp = eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -111,7 +111,7 @@ ok $res, 'unwind in scalar context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - my $temp = (unwind qw/g h i/ => SUB); + my $temp = (unwind qw => SUB); } $res = 0; }->(0); @@ -119,7 +119,7 @@ ok $res, 'unwind in scalar context at sub across loop to void'; sub { $res = 1; - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { $res = undef; } $res = 0; @@ -129,19 +129,19 @@ ok $res, 'unwind in scalar context at sub across test to void'; # --- Scalar to scalar -------------------------------------------------------- $res = sub { - 1, unwind(qw/a b c/ => SUB); + 1, unwind(qw => SUB); }->(0); is $res, 'c', 'unwind in scalar context at sub to scalar'; $res = sub { eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; }->(0); is $res, 'f', 'unwind in scalar context at sub across eval to scalar'; $res = sub { - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { return 'XXX'; } }->(0); @@ -150,17 +150,17 @@ is $res, 'o', 'unwind in scalar context at sub across test to scalar'; # --- Scalar to list ---------------------------------------------------------- @res = sub { - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { return 'XXX'; } }->(0); -is_deeply \@res, [ qw/m n o/ ], 'unwind in scalar context at sub across test to list'; +is_deeply \@res, [ qw ], 'unwind in scalar context at sub across test to list'; # --- List to void ------------------------------------------------------------ sub { $res = 1; - my @temp = unwind(qw/a b c/ => SUB); + my @temp = unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in list context at sub to void'; @@ -168,7 +168,7 @@ ok $res, 'unwind in list context at sub to void'; sub { $res = 1; my @temp = eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -177,7 +177,7 @@ ok $res, 'unwind in list context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - my @temp = (unwind qw/g h i/ => SUB); + my @temp = (unwind qw => SUB); } $res = 0; }->(0); @@ -185,7 +185,7 @@ ok $res, 'unwind in list context at sub across loop to void'; sub { $res = 1; - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { $res = undef; } $res = 0; @@ -195,14 +195,14 @@ ok $res, 'unwind in list context at sub across test to void'; # --- List to scalar ---------------------------------------------------------- $res = sub { - my @temp = (1, unwind(qw/a b c/ => SUB)); + my @temp = (1, unwind(qw => SUB)); return 'XXX'; }->(0); is $res, 'c', 'unwind in list context at sub to scalar'; $res = sub { my @temp = eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; return 'XXX'; }->(0); @@ -210,14 +210,14 @@ is $res, 'f', 'unwind in list context at sub across eval to scalar'; $res = sub { for (1 .. 5) { - my @temp = (7, unwind qw/g h i/ => SUB); + my @temp = (7, unwind qw => SUB); } return 'XXX'; }->(0); is $res, 'i', 'unwind in list context at sub across loop to scalar'; $res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { return 'XXX'; } }->(0); @@ -226,27 +226,27 @@ is $res, 'l', 'unwind in list context at sub across loop iterator to scalar'; # --- List to list ------------------------------------------------------------ @res = sub { - 2, unwind qw/a b c/ => SUB; + 2, unwind qw => SUB; }->(0); -is_deeply \@res, [ qw/a b c/ ], 'unwind in list context at sub to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub to list'; @res = sub { eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; }->(0); -is_deeply \@res, [ qw/d e f/ ], 'unwind in list context at sub across eval to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub across eval to list'; @res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { return 'XXX'; } }->(0); -is_deeply \@res, [ qw/j k l/ ], 'unwind in list context at sub across loop iterator to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub across loop iterator to list'; # --- Prototypes -------------------------------------------------------------- -sub pie { 7, unwind qw/pie good/, $_[0] => SUB } +sub pie { 7, unwind qw, $_[0] => SUB } sub wlist (@) { return @_ } @@ -254,7 +254,7 @@ $res = wlist pie 1; is $res, 3, 'unwind to list prototype to scalar'; @res = wlist pie 2; -is_deeply \@res, [ qw/pie good 2/ ], 'unwind to list prototype to list'; +is_deeply \@res, [ qw ], 'unwind to list prototype to list'; sub wscalar ($$) { return @_ } diff --git a/t/59-unwind-threads.t b/t/59-unwind-threads.t index aabb5fe..236df4c 100644 --- a/t/59-unwind-threads.t +++ b/t/59-unwind-threads.t @@ -9,7 +9,7 @@ sub skipall { Test::More::plan(skip_all => $msg); } -use Config qw/%Config/; +use Config qw<%Config>; BEGIN { my $force = $ENV{PERL_SCOPE_UPPER_TEST_THREADS} ? 1 : !1; @@ -24,7 +24,7 @@ BEGIN { use Test::More; -use Scope::Upper qw/unwind UP SU_THREADSAFE/; +use Scope::Upper qw; my $num; diff --git a/t/81-stress-level.t b/t/81-stress-level.t index 56dfa30..ddc78e8 100644 --- a/t/81-stress-level.t +++ b/t/81-stress-level.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/reap UP HERE/; +use Scope::Upper qw; use Scope::Upper::TestGenerator; diff --git a/t/85-stress-unwind.t b/t/85-stress-unwind.t index 03dee8f..fa52bcd 100644 --- a/t/85-stress-unwind.t +++ b/t/85-stress-unwind.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/unwind UP HERE/; +use Scope::Upper qw; our ($call, @args, $args); @@ -88,7 +88,7 @@ DIAG } } -for ([ ], [ 'A' ], [ qw/B C/ ]) { +for ([ ], [ 'A' ], [ qw ]) { @args = @$_; $args = '(' . join(', ', map "'$_'", @args) . ')'; runtests 0, 0;