From: Vincent Pit Date: Thu, 25 Aug 2011 09:52:10 +0000 (+0200) Subject: Switch to qw<> X-Git-Tag: v0.10~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Prototype-Util.git;a=commitdiff_plain;h=ea95d5eb42f17626bfca0f26e58a7d6c28e74d47 Switch to qw<> --- diff --git a/lib/Sub/Prototype/Util.pm b/lib/Sub/Prototype/Util.pm index efcd974..6bf7790 100644 --- a/lib/Sub/Prototype/Util.pm +++ b/lib/Sub/Prototype/Util.pm @@ -5,8 +5,8 @@ use 5.006; use strict; use warnings; -use Carp qw/croak/; -use Scalar::Util qw/reftype/; +use Carp qw; +use Scalar::Util qw; =head1 NAME @@ -18,15 +18,15 @@ Version 0.09 =cut -use vars qw/$VERSION/; +use vars qw<$VERSION>; $VERSION = '0.09'; =head1 SYNOPSIS - use Sub::Prototype::Util qw/flatten wrap recall/; + use Sub::Prototype::Util qw; - my @a = qw/a b c/; + my @a = qw; my @args = ( \@a, 1, { d => 2 }, undef, 3 ); my @flat = flatten '\@$;$', @args; # ('a', 'b', 'c', 1, { d => 2 }) @@ -45,7 +45,7 @@ They all handle C<5.10>'s C<_> prototype. =cut -my %sigils = qw/SCALAR $ ARRAY @ HASH % GLOB * CODE &/; +my %sigils = qw; my %reftypes = reverse %sigils; sub _check_ref { @@ -313,13 +313,13 @@ The functions L, L and L are only exported on request, =cut -use base qw/Exporter/; +use base qw; -use vars qw/@EXPORT @EXPORT_OK %EXPORT_TAGS/; +use vars qw<@EXPORT @EXPORT_OK %EXPORT_TAGS>; @EXPORT = (); %EXPORT_TAGS = ( - 'funcs' => [ qw/flatten wrap recall/ ] + 'funcs' => [ qw ] ); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; diff --git a/samples/try.pl b/samples/try.pl index 57477fe..3c4426d 100755 --- a/samples/try.pl +++ b/samples/try.pl @@ -5,11 +5,11 @@ use warnings; use Data::Dumper; -use lib qw{blib/lib}; +use lib qw; -use Sub::Prototype::Util qw/flatten recall wrap/; +use Sub::Prototype::Util qw; -my @a = qw/a b c/; +my @a = qw; print "At the beginning, \@a contains :\n", Dumper(\@a); my @args = ( \@a, 1, { d => 2 }, undef, 3 ); diff --git a/t/10-flatten.t b/t/10-flatten.t index a2b9d6d..e410921 100644 --- a/t/10-flatten.t +++ b/t/10-flatten.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 27; -use Sub::Prototype::Util qw/flatten/; +use Sub::Prototype::Util qw; sub exception { my ($msg) = @_; diff --git a/t/11-wrap.t b/t/11-wrap.t index c03654a..88ee5c6 100644 --- a/t/11-wrap.t +++ b/t/11-wrap.t @@ -5,8 +5,8 @@ use warnings; use Test::More tests => 7 + 6 + 3 + 1 + 6 + 1 + (($^V ge v5.10.0) ? 2 : 0) + 1; -use Scalar::Util qw/set_prototype/; -use Sub::Prototype::Util qw/wrap/; +use Scalar::Util qw; +use Sub::Prototype::Util qw; sub exception { my ($msg) = @_; @@ -27,7 +27,7 @@ like $@, exception('Unhandled CODE'), 'recall coderef croaks'; eval { wrap { 'foo' => undef, 'bar' => undef } }; like $@, qr!exactly\s+one\s+key/value\s+pair!, 'recall hashref with 2 pairs croaks'; -eval { wrap 'hlagh', qw/a b c/ }; +eval { wrap 'hlagh', qw }; like $@, exception('Optional arguments'), 'recall takes options in a key => value list'; @@ -40,16 +40,16 @@ $push = wrap 'CORE::push', sub => 0; is($push, $push_exp, 'wrap push as a raw string'); $push = wrap 'CORE::push'; is(ref $push, 'CODE', 'wrap compiled push is a CODE reference'); -my @a = qw/a b/; +my @a = qw; my $ret = $push->(\@a, 7 .. 12); -is_deeply(\@a, [ qw/a b/, 7 .. 12 ], 'wrap compiled push works'); +is_deeply(\@a, [ qw, 7 .. 12 ], 'wrap compiled push works'); is($ret, 8, 'wrap compiled push returns the correct number of elements'); my $push2 = wrap { 'CORE::push' => '\@;$' }; is(ref $push2, 'CODE', 'wrap compiled truncated push is a CODE reference'); -@a = qw/x y z/; +@a = qw; $ret = $push2->(\@a, 3 .. 5); -is_deeply(\@a, [ qw/x y z/, 3 ], 'wrap compiled truncated push works'); +is_deeply(\@a, [ qw, 3 ], 'wrap compiled truncated push works'); is($ret, 4, 'wrap compiled truncated push returns the correct number of elements'); sub cb (\[$@]\[%&]&&); @@ -108,9 +108,9 @@ SKIP: { wrong_ref => 'die "hlagh"', my @tests = ( [ \'a', \'b', [ 'ab' ], 'scalar-scalar' ], - [ \'c', [ qw/d e/ ], [ qw/c d e/ ], 'scalar-array' ], - [ [ qw/f g/ ], \'h', [ qw/f g h/ ], 'array-scalar' ], - [ [ qw/i j/ ], [ qw/k l/ ], [ qw/i j k l/ ], 'array-array' ] + [ \'c', [ qw ], [ qw ], 'scalar-array' ], + [ [ qw ], \'h', [ qw ], 'array-scalar' ], + [ [ qw ], [ qw ], [ qw ], 'array-array' ] ); for (@tests) { my $res = [ $cat->($_->[0], $_->[1]) ]; @@ -131,12 +131,12 @@ sub myit { my $ar = shift; push @$ar, @_; }; if ($^V ge v5.10.0) { set_prototype \&myit, '\@$_'; my $it = wrap 'main::myit'; - my @a = qw/u v w/; + my @a = qw; local $_ = 7; $it->(\@a, 3, 4, 5); - is_deeply(\@a, [ qw/u v w/, 3, 4 ], '_ with arguments'); + is_deeply(\@a, [ qw, 3, 4 ], '_ with arguments'); $it->(\@a, 6); - is_deeply(\@a, [ qw/u v w/, 3, 4, 6, 7 ], '_ without arguments'); + is_deeply(\@a, [ qw, 3, 4, 6, 7 ], '_ without arguments'); } eval { wrap { 'main::dummy' => '\[@%]' }, ref => 'shift' }; diff --git a/t/12-recall.t b/t/12-recall.t index 269cd1d..504510d 100644 --- a/t/12-recall.t +++ b/t/12-recall.t @@ -5,8 +5,8 @@ use warnings; use Test::More tests => 8 + 20 + (($^V ge v5.10.0) ? 4 : 0); -use Scalar::Util qw/set_prototype/; -use Sub::Prototype::Util qw/recall/; +use Scalar::Util qw; +use Sub::Prototype::Util qw; sub exception { my ($msg) = @_;