From: Vincent Pit Date: Wed, 19 Jan 2011 17:45:36 +0000 (+0100) Subject: Switch to qw<> X-Git-Tag: v0.46~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=3bc98bdbdb230943e7fb3135e325f10013acac2d;p=perl%2Fmodules%2FVariable-Magic.git Switch to qw<> --- diff --git a/Makefile.PL b/Makefile.PL index 57d8b81..b040245 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,7 +7,7 @@ use ExtUtils::MakeMaker; BEGIN { eval { require Config }; die 'OS unsupported' if $@; - Config->import(qw/%Config/); + Config->import(qw<%Config>); } my @DEFINES; @@ -29,15 +29,15 @@ print $is_as_822 ? "yes\n" : "no\n"; my $is_gcc_34 = 0; print "Checking if this is gcc 3.4 on Windows trying to link against an import library... "; if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) { - my ($libperl, $gccversion) = map $_ || '', @Config{qw/libperl gccversion/}; + my ($libperl, $gccversion) = map $_ || '', @Config{qw}; if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) { $is_gcc_34 = 1; - my ($lddlflags, $ldflags) = @Config{qw/lddlflags ldflags/}; + my ($lddlflags, $ldflags) = @Config{qw}; $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags; $libperl = "-l$libperl"; my $libdirs = join ' ', map { s/(?}; $macro{LDDLFLAGS} = "$lddlflags $libdirs $libperl"; $macro{LDFLAGS} = "$ldflags $libdirs $libperl"; $macro{PERL_ARCHIVE} = '', diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 129da7c..c52dcc8 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -22,7 +22,7 @@ BEGIN { =head1 SYNOPSIS - use Variable::Magic qw/wizard cast VMG_OP_INFO_NAME/; + use Variable::Magic qw; { # A variable tracer my $wiz = wizard set => sub { print "now set to ${$_[0]}!\n" }, @@ -301,11 +301,11 @@ sub wizard { my %opts = @_; - my @keys = qw/data op_info get set len clear free/; + my @keys = qw; push @keys, 'copy' if MGf_COPY; push @keys, 'dup' if MGf_DUP; push @keys, 'local' if MGf_LOCAL; - push @keys, qw/fetch store exists delete copy_key/ if VMG_UVAR; + push @keys, qw if VMG_UVAR; my ($wiz, $err); { @@ -440,7 +440,7 @@ It is similar to using inside-out objects, but without the drawback of having to { package Magical::UserData; - use Variable::Magic qw/wizard cast getdata/; + use Variable::Magic qw; my $wiz = wizard data => sub { \$_[1] }; @@ -575,12 +575,12 @@ All the constants are also only exported on request, either individually or by t =cut -use base qw/Exporter/; +use base qw; our @EXPORT = (); our %EXPORT_TAGS = ( - 'funcs' => [ qw/wizard cast getdata dispell/ ], - 'consts' => [ qw/ + 'funcs' => [ qw ], + 'consts' => [ qw< MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID @@ -590,7 +590,7 @@ our %EXPORT_TAGS = ( VMG_PERL_PATCHLEVEL VMG_THREADSAFE VMG_FORKSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT - / ], + > ], ); our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; diff --git a/samples/copy.pl b/samples/copy.pl index 6a705f6..e24dc80 100755 --- a/samples/copy.pl +++ b/samples/copy.pl @@ -3,8 +3,8 @@ use strict; use warnings; -use lib qw{blib/arch blib/lib}; -use Variable::Magic qw/wizard cast/; +use lib qw; +use Variable::Magic qw; use Tie::Hash; my $wiz = wizard copy => sub { print STDERR "COPY $_[2] => $_[3]\n" }, diff --git a/samples/magic.pl b/samples/magic.pl index 5ce53ae..3fc8a8f 100755 --- a/samples/magic.pl +++ b/samples/magic.pl @@ -3,8 +3,8 @@ use strict; use warnings; -use lib qw{blib/arch blib/lib}; -use Variable::Magic qw/wizard cast dispell/; +use lib qw; +use Variable::Magic qw; sub foo { print STDERR "got ${$_[0]}!\n" } my $bar = sub { ++${$_[0]}; print STDERR "now set to ${$_[0]}!\n"; }; @@ -14,7 +14,7 @@ my $a = 1; my $wiz = wizard get => \&foo, set => $bar, free => sub { print STDERR "deleted!\n"; }; - cast $a, $wiz, qw/a b c/; + cast $a, $wiz, qw; ++$a; # "got 1!", "now set to 3!" dispell $a, $wiz; cast $a, $wiz; diff --git a/samples/synopsis.pl b/samples/synopsis.pl index 4b99d41..5b5cd7c 100755 --- a/samples/synopsis.pl +++ b/samples/synopsis.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use Variable::Magic qw/wizard cast VMG_OP_INFO_NAME/; +use Variable::Magic qw; { my $wiz = wizard set => sub { print "now set to ${$_[0]}!\n" }, diff --git a/samples/uvar.pl b/samples/uvar.pl index 700692f..d1e52ab 100755 --- a/samples/uvar.pl +++ b/samples/uvar.pl @@ -3,8 +3,8 @@ use strict; use warnings; -use lib qw{blib/arch blib/lib}; -use Variable::Magic qw/wizard cast dispell/; +use lib qw; +use Variable::Magic qw; my $wiz = wizard fetch => sub { print STDERR "$_[0] FETCH KEY $_[2]\n" }, diff --git a/samples/vm_vs_tie.pl b/samples/vm_vs_tie.pl index c712b71..b7f888d 100755 --- a/samples/vm_vs_tie.pl +++ b/samples/vm_vs_tie.pl @@ -5,10 +5,10 @@ use warnings; use Tie::Hash; -use lib qw{blib/arch blib/lib}; -use Variable::Magic qw/wizard cast VMG_UVAR/; +use lib qw; +use Variable::Magic qw; -use Benchmark qw/cmpthese/; +use Benchmark qw; die 'Your perl does not support the nice uvar magic of 5.10.*' unless VMG_UVAR; diff --git a/t/01-import.t b/t/01-import.t index 8fdd778..b7be4ce 100644 --- a/t/01-import.t +++ b/t/01-import.t @@ -12,7 +12,7 @@ my %syms = ( cast => '\[$@%&*]$@', getdata => '\[$@%&*]$', dispell => '\[$@%&*]$', - map { $_ => '' } qw/ + map { $_ => '' } qw< MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID @@ -22,7 +22,7 @@ my %syms = ( VMG_PERL_PATCHLEVEL VMG_THREADSAFE VMG_FORKSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT - / + > ); for (sort keys %syms) { diff --git a/t/10-simple.t b/t/10-simple.t index 69c3a40..70b4f6e 100644 --- a/t/10-simple.t +++ b/t/10-simple.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 43; -use Variable::Magic qw/wizard cast dispell MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR/; +use Variable::Magic qw; my $inv_wiz_obj = qr/Invalid\s+wizard\s+object\s+at\s+\Q$0\E/; diff --git a/t/11-multiple.t b/t/11-multiple.t index 58cc8a8..07b1899 100644 --- a/t/11-multiple.t +++ b/t/11-multiple.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 33 + 41; -use Variable::Magic qw/wizard cast dispell VMG_UVAR/; +use Variable::Magic qw; my $n = 3; my @w; diff --git a/t/13-data.t b/t/13-data.t index b693f92..bc4248e 100644 --- a/t/13-data.t +++ b/t/13-data.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 35; -use Variable::Magic qw/wizard getdata cast dispell/; +use Variable::Magic qw; my $c = 1; @@ -53,7 +53,7 @@ $res = eval { dispell $a, $wiz }; is($@, '', 'dispell doesn\'t croak'); ok($res, 'dispell returns true'); -$res = eval { cast $a, $wiz, qw/z j t/ }; +$res = eval { cast $a, $wiz, qw }; is($@, '', 'cast with arguments doesn\'t croak'); ok($res, 'cast with arguments returns true'); diff --git a/t/14-callbacks.t b/t/14-callbacks.t index 91ee3bd..77fdd00 100644 --- a/t/14-callbacks.t +++ b/t/14-callbacks.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 17; -use Variable::Magic qw/wizard cast/; +use Variable::Magic qw; my $wiz = eval { wizard get => sub { undef } }; is($@, '', 'wizard creation doesn\'t croak'); diff --git a/t/15-self.t b/t/15-self.t index cfca708..bf6aa35 100644 --- a/t/15-self.t +++ b/t/15-self.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 17; -use Variable::Magic qw/wizard cast dispell getdata/; +use Variable::Magic qw; my $c = 0; diff --git a/t/16-huf.t b/t/16-huf.t index 0934219..32f7677 100644 --- a/t/16-huf.t +++ b/t/16-huf.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast dispell VMG_UVAR/; +use Variable::Magic qw; if (!VMG_UVAR) { plan skip_all => 'No nice uvar magic for this perl'; @@ -23,7 +23,7 @@ if ($@) { use lib 't/lib'; use Variable::Magic::TestWatcher; -my $wiz = init_watcher [ qw/fetch store/ ], 'huf'; +my $wiz = init_watcher [ qw ], 'huf'; ok defined($wiz), 'huf: wizard with uvar is defined'; is ref($wiz), 'SCALAR', 'huf: wizard with uvar is a scalar ref'; diff --git a/t/17-ctl.t b/t/17-ctl.t index 38924d6..92a4c0c 100644 --- a/t/17-ctl.t +++ b/t/17-ctl.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 4 * 8 + 10 + 1 + 1; -use Variable::Magic qw/wizard cast VMG_UVAR/; +use Variable::Magic qw; sub expect { my ($name, $where, $suffix) = @_; @@ -247,7 +247,7 @@ SKIP: skip 'No working Capture::Tiny is installed'=> $count unless $has_capture_tiny; my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' }); -use Variable::Magic qw/wizard cast/; { BEGIN { $^H |= 0x020000; cast %^H, wizard free => sub { die q[cucumber] } } } +use Variable::Magic qw; { BEGIN { $^H |= 0x020000; cast %^H, wizard free => sub { die q[cucumber] } } } CODE skip 'Test code didn\'t run properly' => $count unless defined $output; like $output, expect('cucumber', '-e', "\nExecution(?s:.*)"), @@ -265,7 +265,7 @@ SKIP: skip 'No working Capture::Tiny is installed'=> $count unless $has_capture_tiny; my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' }); -use Variable::Magic qw/wizard cast/; BEGIN { cast %::, wizard fetch => sub { die q[salsify] } } hlagh() +use Variable::Magic qw; BEGIN { cast %::, wizard fetch => sub { die q[salsify] } } hlagh() CODE skip 'Test code didn\'t run properly' => $count unless defined $output; my $suffix = "\nExecution(?s:.*)"; diff --git a/t/18-opinfo.t b/t/18-opinfo.t index 6cf8768..161efb9 100644 --- a/t/18-opinfo.t +++ b/t/18-opinfo.t @@ -5,9 +5,9 @@ use warnings; use Test::More tests => 17 * (3 + 4) + 5 + 1; -use Config qw/%Config/; +use Config qw<%Config>; -use Variable::Magic qw/wizard cast dispell VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/; +use Variable::Magic qw; sub Variable::Magic::TestPkg::foo { } diff --git a/t/20-get.t b/t/20-get.t index 6590070..3411417 100644 --- a/t/20-get.t +++ b/t/20-get.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => (2 * 4 + 2) + (2 * 2) + 1; -use Variable::Magic qw/cast/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; diff --git a/t/21-set.t b/t/21-set.t index 25535e2..70af0e4 100644 --- a/t/21-set.t +++ b/t/21-set.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => (2 * 5 + 3) + (2 * 2 + 1); -use Variable::Magic qw/cast/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; diff --git a/t/22-len.t b/t/22-len.t index 01a06dd..a35375f 100644 --- a/t/22-len.t +++ b/t/22-len.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 39 + (2 * 2 + 1); -use Variable::Magic qw/wizard cast dispell VMG_COMPAT_SCALAR_LENGTH_NOLEN/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestValue; @@ -17,7 +17,7 @@ my $d; my $wiz = wizard len => sub { $d = $_[2]; ++$c; return $n }; is $c, 0, 'len: wizard() doesn\'t trigger magic'; -my @a = qw/a b c/; +my @a = qw; $c = 0; cast @a, $wiz; diff --git a/t/23-clear.t b/t/23-clear.t index a3aad82..3af5545 100644 --- a/t/23-clear.t +++ b/t/23-clear.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => (2 * 5 + 2) + (2 * 2 + 1) + 1; -use Variable::Magic qw/cast dispell/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; @@ -13,7 +13,7 @@ use Variable::Magic::TestValue; my $wiz = init_watcher 'clear', 'clear'; -my @a = qw/a b c/; +my @a = qw; watch { cast @a, $wiz } { }, 'cast array'; diff --git a/t/24-free.t b/t/24-free.t index c6daebe..eaa7db3 100644 --- a/t/24-free.t +++ b/t/24-free.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 2 * 5 + 1; -use Variable::Magic qw/cast/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; diff --git a/t/25-copy.t b/t/25-copy.t index 0630ae3..a18022f 100644 --- a/t/25-copy.t +++ b/t/25-copy.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -use Variable::Magic qw/cast dispell MGf_COPY/; +use Variable::Magic qw; if (MGf_COPY) { plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 1; @@ -79,7 +79,7 @@ SKIP: { watch { my ($k, $v) = each %h } { copy => 1 }, 'tied hash each'; my @k = watch { keys %h } { }, 'tied hash keys'; - is_deeply [ sort @k ], [ qw/a c/ ], 'copy: tied hash keys correctly'; + is_deeply [ sort @k ], [ qw ], 'copy: tied hash keys correctly'; my @v = watch { values %h } { copy => 2 }, 'tied hash values'; is_deeply [ sort { $a <=> $b } @v ], [ 1, 3 ], 'copy: tied hash values correctly'; diff --git a/t/27-local.t b/t/27-local.t index d15ba19..086d619 100644 --- a/t/27-local.t +++ b/t/27-local.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -use Variable::Magic qw/cast MGf_LOCAL/; +use Variable::Magic qw; if (MGf_LOCAL) { plan tests => 2 * 3 + 1 + 1; diff --git a/t/28-uvar.t b/t/28-uvar.t index acc761f..0eaf001 100644 --- a/t/28-uvar.t +++ b/t/28-uvar.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast dispell VMG_UVAR/; +use Variable::Magic qw; if (VMG_UVAR) { plan tests => 2 * 15 + 12 + 14 + (4 * 2 * 2 + 1 + 1) + 1; @@ -17,7 +17,7 @@ use lib 't/lib'; use Variable::Magic::TestWatcher; use Variable::Magic::TestValue; -my $wiz = init_watcher [ qw/fetch store exists delete/ ], 'uvar'; +my $wiz = init_watcher [ qw ], 'uvar'; my %h = (a => 1, b => 2, c => 3); diff --git a/t/30-scalar.t b/t/30-scalar.t index ab20ed6..71fa3cb 100644 --- a/t/30-scalar.t +++ b/t/30-scalar.t @@ -3,11 +3,11 @@ use strict; use warnings; -use Config qw/%Config/; +use Config qw<%Config>; use Test::More tests => (2 * 14 + 2) + 2 * (2 * 8 + 4) + 3 + 1; -use Variable::Magic qw/wizard cast dispell MGf_COPY/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; @@ -15,7 +15,7 @@ use Variable::Magic::TestWatcher; my $is_5130_release = ($] == 5.013 && !$Config{git_describe}) ? 1 : 0; my $wiz = init_watcher - [ qw/get set len clear free copy dup local fetch store exists delete/ ], + [ qw ], 'scalar'; my $n = int rand 1000; @@ -122,5 +122,5 @@ SKIP: { }; is $@, '', 'cast copy magic on tied array'; - watch { delete $a[0] } [ qw/get clear free/ ], 'delete from tied array'; + watch { delete $a[0] } [ qw ], 'delete from tied array'; } diff --git a/t/31-array.t b/t/31-array.t index b5ff1ed..20ab356 100644 --- a/t/31-array.t +++ b/t/31-array.t @@ -5,13 +5,18 @@ use warnings; use Test::More tests => 2 * 27 + 13 + 1; -use Variable::Magic qw/cast dispell VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR/; +use Variable::Magic qw< + cast dispell + VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID + VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID + VMG_COMPAT_ARRAY_UNDEF_CLEAR +>; use lib 't/lib'; use Variable::Magic::TestWatcher; my $wiz = init_watcher - [ qw/get set len clear free copy dup local fetch store exists delete/ ], + [ qw ], 'array'; my @n = map { int rand 1000 } 1 .. 5; @@ -33,7 +38,7 @@ $b = watch { \@a } { }, 'reference'; @b = watch { @a[2 .. 4] } { }, 'slice'; is_deeply \@b, [ @n[2 .. 4] ], 'array: slice correctly'; -watch { @a = qw/a b d/ } { set => 3, clear => 1 }, 'assign'; +watch { @a = qw } { set => 3, clear => 1 }, 'assign'; watch { $a[2] = 'c' } { }, 'assign old element'; diff --git a/t/32-hash.t b/t/32-hash.t index 0ad2e96..1bbd300 100644 --- a/t/32-hash.t +++ b/t/32-hash.t @@ -5,16 +5,16 @@ use warnings; use Test::More tests => (2 * 21 + 7) + (2 * 5 + 5) + 1; -use Variable::Magic qw/cast dispell MGf_COPY VMG_UVAR/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; my $wiz = init_watcher - [ qw/get set len clear free copy dup local fetch store exists delete/ ], + [ qw ], 'hash'; -my %n = map { $_ => int rand 1000 } qw/foo bar baz qux/; +my %n = map { $_ => int rand 1000 } qw; my %h = %n; watch { cast %h, $wiz } { }, 'cast'; @@ -34,9 +34,9 @@ is_deeply \%b, \%n, 'hash: assign to correctly'; $s = watch { \%h } { }, 'reference'; -my @b = watch { @h{qw/bar qux/} } +my @b = watch { @h{qw} } +{ (fetch => 2) x VMG_UVAR }, 'slice'; -is_deeply \@b, [ @n{qw/bar qux/} ], 'hash: slice correctly'; +is_deeply \@b, [ @n{qw} ], 'hash: slice correctly'; watch { %h = () } { clear => 1 }, 'empty in list context'; @@ -44,7 +44,7 @@ watch { %h = (a => 1, d => 3); () } +{ (store => 2, copy => 2) x VMG_UVAR, clear => 1 }, 'assign from list in void context'; -watch { %h = map { $_ => 1 } qw/a b d/; } +watch { %h = map { $_ => 1 } qw; } +{ (exists => 3, store => 3, copy => 3) x VMG_UVAR, clear => 1 }, 'assign from map in list context'; @@ -57,7 +57,7 @@ watch { $h{c} = 3; () } +{ (store => 1, copy => 1) x VMG_UVAR }, $s = watch { %h } { }, 'buckets'; @b = watch { keys %h } { }, 'keys'; -is_deeply [ sort @b ], [ qw/a b c d/ ], 'hash: keys correctly'; +is_deeply [ sort @b ], [ qw ], 'hash: keys correctly'; @b = watch { values %h } { }, 'values'; is_deeply [ sort { $a <=> $b } @b ], [ 1, 1, 2, 3 ], 'hash: values correctly'; diff --git a/t/33-code.t b/t/33-code.t index a2812e3..a2d6711 100644 --- a/t/33-code.t +++ b/t/33-code.t @@ -5,13 +5,13 @@ use warnings; use Test::More tests => 2 * 12 + 11 + 1; -use Variable::Magic qw/cast dispell/; +use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; my $wiz = init_watcher - [ qw/get set len clear free copy dup local fetch store exists delete/ ], + [ qw ], 'code'; my $x = 0; diff --git a/t/34-glob.t b/t/34-glob.t index bbfbeee..74183c9 100644 --- a/t/34-glob.t +++ b/t/34-glob.t @@ -5,15 +5,17 @@ use warnings; use Test::More; -eval "use Symbol qw/gensym/"; -if ($@) { - plan skip_all => "Symbol::gensym required for testing magic for globs"; -} else { - plan tests => 2 * 12 + 1; - defined and diag "Using Symbol $_" for $Symbol::VERSION; +BEGIN { + local $@; + if (eval "use Symbol qw; 1") { + plan tests => 2 * 12 + 1; + defined and diag "Using Symbol $_" for $Symbol::VERSION; + } else { + plan skip_all => "Symbol::gensym required for testing magic for globs"; + } } -use Variable::Magic qw/cast dispell VMG_COMPAT_GLOB_GET/; +use Variable::Magic qw; my %get = VMG_COMPAT_GLOB_GET ? (get => 1) : (); @@ -21,7 +23,7 @@ use lib 't/lib'; use Variable::Magic::TestWatcher; my $wiz = init_watcher - [ qw/get set len clear free copy dup local fetch store exists delete/ ], + [ qw ], 'glob'; local *a = gensym(); @@ -31,7 +33,7 @@ watch { cast *a, $wiz } +{ }, 'cast'; watch { local *b = *a } +{ %get }, 'assign to'; watch { *a = \1 } +{ %get, set => 1 }, 'assign scalar slot'; -watch { *a = [ qw/x y/ ] } +{ %get, set => 1 }, 'assign array slot'; +watch { *a = [ qw ] } +{ %get, set => 1 }, 'assign array slot'; watch { *a = { u => 1 } } +{ %get, set => 1 }, 'assign hash slot'; watch { *a = sub { } } +{ %get, set => 1 }, 'assign code slot'; diff --git a/t/35-stash.t b/t/35-stash.t index 6be01aa..d1fc7a4 100644 --- a/t/35-stash.t +++ b/t/35-stash.t @@ -5,7 +5,10 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast dispell VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/; +use Variable::Magic qw< + wizard cast dispell + VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT +>; my $run; if (VMG_UVAR) { @@ -27,7 +30,7 @@ $_ => sub { () } CB -} qw/fetch store exists delete/); +} qw); $code .= ', data => sub { +{ guard => 0 } }'; @@ -51,8 +54,8 @@ cast %Hlagh::, $wiz; is $@, "ok\n", 'stash: variables compiled fine'; is_deeply \%mg, { - fetch => [ qw/thing stuff/ ], - store => [ qw/thing stuff/ ], + fetch => [ qw ], + store => [ qw ], }, 'stash: variables'; } @@ -70,7 +73,7 @@ cast %Hlagh::, $wiz; is $@, "ok\n", 'stash: function definitions compiled fine'; is_deeply \%mg, { - store => [ qw/eat shoot leave shoot/ ], + store => [ qw ], }, 'stash: function definitions'; } @@ -88,7 +91,7 @@ cast %Hlagh::, $wiz; roam(); }; - my @calls = qw/eat shoot leave roam yawn roam/; + my @calls = qw; is $@, "ok\n", 'stash: function calls compiled fine'; is_deeply \%mg, { @@ -104,7 +107,7 @@ cast %Hlagh::, $wiz; is $@, '', 'stash: valid method call ran fine'; is_deeply \%mg, { - fetch => [ qw/shoot/ ], + fetch => [ qw ], }, 'stash: valid method call'; } @@ -115,7 +118,7 @@ cast %Hlagh::, $wiz; is $@, '', 'stash: second valid method call ran fine'; is_deeply \%mg, { - fetch => [ qw/shoot/ ], + fetch => [ qw ], }, 'stash: second valid method call'; } @@ -126,7 +129,7 @@ cast %Hlagh::, $wiz; is $@, '', 'stash: valid dynamic method call ran fine'; is_deeply \%mg, { - store => [ qw/shoot/ ], + store => [ qw ], }, 'stash: valid dynamic method call'; } @@ -142,7 +145,7 @@ cast %Hlagh::, $wiz; is $@, '', 'inherited valid method call ran fine'; is_deeply \%mg, { - fetch => [ qw/ISA leave/ ], + fetch => [ qw ], }, 'stash: inherited valid method call'; } @@ -162,7 +165,7 @@ cast %Hlagh::, $wiz; is $@, '', 'inherited previously called valid method call ran fine'; is_deeply \%mg, { - fetch => [ qw/shoot/ ], + fetch => [ qw ], }, 'stash: inherited previously called valid method call'; } @@ -182,8 +185,8 @@ cast %Hlagh::, $wiz; like $@, qr/^Can't locate object method "unknown" via package "Hlagh"/, 'stash: invalid method call croaked'; is_deeply \%mg, { - fetch => [ qw/unknown/ ], - store => [ qw/unknown AUTOLOAD/ ], + fetch => [ qw ], + store => [ qw ], }, 'stash: invalid method call'; } @@ -194,7 +197,7 @@ cast %Hlagh::, $wiz; like $@, qr/^Can't locate object method "unknown_too" via package "Hlagh"/, 'stash: invalid dynamic method call croaked'; is_deeply \%mg, { - store => [ qw/unknown_too AUTOLOAD/ ], + store => [ qw ], }, 'stash: invalid dynamic method call'; } @@ -205,7 +208,7 @@ cast %Hlagh::, $wiz; like $@, qr/^Can't locate object method "also_unknown" via package "Hlagher"/, 'stash: invalid inherited method call croaked'; is_deeply \%mg, { - fetch => [ qw/also_unknown AUTOLOAD/ ], + fetch => [ qw ], }, 'stash: invalid method call'; } @@ -222,7 +225,7 @@ cast %Hlagh::, $wiz; is $@, '', 'stash: delete executed fine'; is_deeply \%mg, { store => [ - qw/nevermentioned nevermentioned eat eat shoot shoot nevermentioned/ + qw ], }, 'stash: delete'; } @@ -236,7 +239,7 @@ dispell %Hlagh::, $wiz; { package AutoHlagh; - use vars qw/$AUTOLOAD/; + use vars qw<$AUTOLOAD>; sub AUTOLOAD { return $AUTOLOAD } } @@ -252,8 +255,8 @@ cast %AutoHlagh::, $wiz; is $res, 'AutoHlagh::autoloaded', 'stash: autoloaded method call returned the right thing'; is_deeply \%mg, { - fetch => [ qw/autoloaded/ ], - store => [ qw/autoloaded AUTOLOAD AUTOLOAD/ ], + fetch => [ qw ], + store => [ qw ], }, 'stash: autoloaded method call'; } @@ -273,8 +276,8 @@ cast %AutoHlagh::, $wiz; is $res, 'AutoHlagher::also_autoloaded', 'stash: inherited autoloaded method returned the right thing'; is_deeply \%mg, { - fetch => [ qw/also_autoloaded AUTOLOAD/ ], - store => [ qw/AUTOLOAD/ ], + fetch => [ qw ], + store => [ qw ], }, 'stash: inherited autoloaded method call'; } @@ -291,7 +294,7 @@ $_ => sub { () } CB -} qw/fetch store exists delete/); +} qw); my $uo_exp = $] < 5.011002 ? 2 : 3; diff --git a/t/40-threads.t b/t/40-threads.t index b86a4b4..013794b 100644 --- a/t/40-threads.t +++ b/t/40-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_VARIABLE_MAGIC_TEST_THREADS} ? 1 : !1; @@ -27,7 +27,10 @@ BEGIN { use Test::More; # after threads -use Variable::Magic qw/wizard cast dispell getdata VMG_THREADSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/; +use Variable::Magic qw< + wizard cast dispell getdata + VMG_THREADSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT +>; BEGIN { skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE; diff --git a/t/41-clone.t b/t/41-clone.t index d66d098..cf29a8b 100644 --- a/t/41-clone.t +++ b/t/41-clone.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_VARIABLE_MAGIC_TEST_THREADS} ? 1 : !1; @@ -27,7 +27,10 @@ BEGIN { use Test::More; # after threads -use Variable::Magic qw/wizard cast dispell getdata VMG_THREADSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/; +use Variable::Magic qw< + wizard cast dispell getdata + VMG_THREADSAFE VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT +>; BEGIN { skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE; diff --git a/t/80-leaks.t b/t/80-leaks.t index 647419f..7b2a3f0 100644 --- a/t/80-leaks.t +++ b/t/80-leaks.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 11; -use Variable::Magic qw/wizard cast getdata/; +use Variable::Magic qw; our $destroyed; diff --git a/t/lib/Variable/Magic/TestScopeEnd.pm b/t/lib/Variable/Magic/TestScopeEnd.pm index 1e08a8e..1eca93b 100644 --- a/t/lib/Variable/Magic/TestScopeEnd.pm +++ b/t/lib/Variable/Magic/TestScopeEnd.pm @@ -2,7 +2,7 @@ package Variable::Magic::TestScopeEnd; use Test::More; -use Variable::Magic qw/wizard cast/; +use Variable::Magic qw; my $wiz; diff --git a/t/lib/Variable/Magic/TestValue.pm b/t/lib/Variable/Magic/TestValue.pm index 491055f..2b735dc 100644 --- a/t/lib/Variable/Magic/TestValue.pm +++ b/t/lib/Variable/Magic/TestValue.pm @@ -5,11 +5,11 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast/; +use Variable::Magic qw; -use base qw/Exporter/; +use base qw; -our @EXPORT = qw/init_value value/; +our @EXPORT = qw; our ($exp, $prefix, $desc); diff --git a/t/lib/Variable/Magic/TestWatcher.pm b/t/lib/Variable/Magic/TestWatcher.pm index bcbd67e..f9ba0ea 100644 --- a/t/lib/Variable/Magic/TestWatcher.pm +++ b/t/lib/Variable/Magic/TestWatcher.pm @@ -5,12 +5,12 @@ use warnings; use Test::More; -use Carp qw/croak/; -use Variable::Magic qw/wizard/; +use Carp qw; +use Variable::Magic qw; -use base qw/Exporter/; +use base qw; -our @EXPORT = qw/init_watcher watch/; +our @EXPORT = qw; sub _types { my $t = shift;