From: Vincent Pit Date: Sun, 7 Aug 2011 16:17:22 +0000 (+0200) Subject: Replace $] by "$]" X-Git-Tag: v0.47~27 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=b30ad18085c2c1d922eff05ee4801c38ad465807;p=perl%2Fmodules%2FVariable-Magic.git Replace $] by "$]" An old bug could cause $] to be initialized to a wrong decimal value. Since its stringified value was always right, we use it instead. Occurences of $^V were also replaced by $]. --- diff --git a/Makefile.PL b/Makefile.PL index b040245..ad049a7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -20,7 +20,7 @@ my $as_perl = eval { my $is_as_822 = 0; print "Checking if this is ActiveState Perl 5.8.8 build 822 or higher... "; -if ($^V eq v5.8.8 and defined $as_perl and $as_perl >= 822) { +if ("$]" == 5.008008 and defined $as_perl and $as_perl >= 822) { $is_as_822 = 1; push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1'; } @@ -46,13 +46,13 @@ if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) { print $is_gcc_34 ? "yes\n" : "no\n"; # Threads, Windows and 5.8.x don't seem to be best friends -if ($^O eq 'MSWin32' && $^V lt v5.9.0) { +if ($^O eq 'MSWin32' && "$]" < 5.009) { push @DEFINES, '-DVMG_MULTIPLICITY=0'; print "Thread safety disabled for perl 5.8.x on Windows.\n" } # Fork emulation got "fixed" in 5.10.1 -if ($^O eq 'MSWin32' && $^V lt v5.10.1) { +if ($^O eq 'MSWin32' && "$]" < 5.010001) { push @DEFINES, '-DVMG_FORKSAFE=0'; print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n"; } diff --git a/t/17-ctl.t b/t/17-ctl.t index 92a4c0c..ca22761 100644 --- a/t/17-ctl.t +++ b/t/17-ctl.t @@ -269,9 +269,9 @@ use Variable::Magic qw; BEGIN { cast %::, wizard fetch => sub { die CODE skip 'Test code didn\'t run properly' => $count unless defined $output; my $suffix = "\nExecution(?s:.*)"; - if ($] >= 5.011005) { + if ("$]" >= 5.011005) { $suffix = "(?:\nsalsify at -e line \\d+.){12}" . $suffix; - } elsif ($] >= 5.011) { + } elsif ("$]" >= 5.011) { $suffix = "(?:\nsalsify at -e line \\d+.){3}" . $suffix; } like $output, expect('salsify', '-e', $suffix), diff --git a/t/18-opinfo.t b/t/18-opinfo.t index 161efb9..4da06b9 100644 --- a/t/18-opinfo.t +++ b/t/18-opinfo.t @@ -11,12 +11,13 @@ use Variable::Magic qw; sub Variable::Magic::TestPkg::foo { } -my $is_5130_release = ($] == 5.013 && !$Config{git_describe}) ? 1 : 0; +my $is_5130_release = ("$]" == 5.013 && !$Config{git_describe}) ? 1 : 0; -my $aelem = $] <= 5.008003 ? 'aelem' - : ($] < 5.013 or $is_5130_release) ? 'aelemfast' - : 'sassign'; -my $aelemf = ($] < 5.013 or $is_5130_release) ? 'aelemfast' : 'sassign'; +my $aelem = "$]" <= 5.008003 ? 'aelem' + : ("$]" < 5.013 or $is_5130_release) + ? 'aelemfast' + : 'sassign'; +my $aelemf = ("$]" < 5.013 or $is_5130_release) ? 'aelemfast' : 'sassign'; my $aelemf_op = $aelemf eq 'sassign' ? 'B::BINOP' : $Config{useithreads} ? 'B::PADOP' : 'B::SVOP'; diff --git a/t/30-scalar.t b/t/30-scalar.t index 71fa3cb..caf76c9 100644 --- a/t/30-scalar.t +++ b/t/30-scalar.t @@ -12,7 +12,7 @@ use Variable::Magic qw; use lib 't/lib'; use Variable::Magic::TestWatcher; -my $is_5130_release = ($] == 5.013 && !$Config{git_describe}) ? 1 : 0; +my $is_5130_release = ("$]" == 5.013 && !$Config{git_describe}) ? 1 : 0; my $wiz = init_watcher [ qw ], @@ -72,7 +72,8 @@ $b = watch { exists $a[1] } { }, 'array element: exists'; is $b, 1, 'scalar: array element: exists correctly'; # $b has to be set inside the block for the test to pass on 5.8.3 and lower -watch { $b = delete $a[1] } { get => 1, free => ($] > 5.008005 ? 1 : 0) }, 'array element: delete'; +watch { $b = delete $a[1] } { get => 1, free => ("$]" > 5.008005 ? 1 : 0) }, + 'array element: delete'; is $b, 6, 'scalar: array element: delete correctly'; watch { $a[1] = 4 } { }, 'array element: set after delete'; diff --git a/t/34-glob.t b/t/34-glob.t index 74183c9..4592f4b 100644 --- a/t/34-glob.t +++ b/t/34-glob.t @@ -44,7 +44,7 @@ watch { watch { cast *b, $wiz } +{ }, 'cast 2'; } +{ }, 'scope end'; -%get = () if $] >= 5.013007; +%get = () if "$]" >= 5.013007; watch { undef *a } +{ %get }, 'undef'; diff --git a/t/35-stash.t b/t/35-stash.t index d1fc7a4..d8b8168 100644 --- a/t/35-stash.t +++ b/t/35-stash.t @@ -96,7 +96,7 @@ cast %Hlagh::, $wiz; is $@, "ok\n", 'stash: function calls compiled fine'; is_deeply \%mg, { fetch => \@calls, - store => ($] < 5.011002 ? \@calls : [ map { ($_) x 2 } @calls ]), + store => ("$]" < 5.011002 ? \@calls : [ map { ($_) x 2 } @calls ]), }, 'stash: function calls'; } @@ -296,7 +296,7 @@ $_ => sub { CB } qw); -my $uo_exp = $] < 5.011002 ? 2 : 3; +my $uo_exp = "$]" < 5.011002 ? 2 : 3; $code .= ', data => sub { +{ guard => 0 } }'; diff --git a/t/40-threads.t b/t/40-threads.t index 013794b..f67dfc3 100644 --- a/t/40-threads.t +++ b/t/40-threads.t @@ -18,7 +18,7 @@ BEGIN { skipall 'This perl wasn\'t built to support threads' unless $Config{useithreads}; skipall 'perl 5.13.4 required to test thread safety' - unless $force or $] >= 5.013004; + unless $force or "$]" >= 5.013004; skipall "threads $t_v required to test thread safety" unless eval "use threads $t_v; 1"; skipall "threads::shared $ts_v required to test thread safety" diff --git a/t/41-clone.t b/t/41-clone.t index cf29a8b..d0f9bfe 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -18,7 +18,7 @@ BEGIN { skipall 'This perl wasn\'t built to support threads' unless $Config{useithreads}; skipall 'perl 5.13.4 required to test thread safety' - unless $force or $] >= 5.013004; + unless $force or "$]" >= 5.013004; skipall "threads $t_v required to test thread safety" unless eval "use threads $t_v; 1"; skipall "threads::shared $ts_v required to test thread safety"