From: Vincent Pit Date: Wed, 24 Aug 2011 16:09:48 +0000 (+0200) Subject: Replace $] by "$]" X-Git-Tag: v0.12~4 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=commitdiff_plain;h=61f64dfa5fa4f435e6cd854d22e4325ef1eb0068 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 1e126e8..ee097e2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -34,12 +34,12 @@ 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, '-DLT_MULTIPLICITY=0'; } # 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, '-DLT_FORKSAFE=0'; } diff --git a/t/11-args.t b/t/11-args.t index 695d6c9..a101890 100644 --- a/t/11-args.t +++ b/t/11-args.t @@ -96,7 +96,7 @@ use Test::More tests => 14 + 6; { my $expect = qr/^Lexical::Types mangler should return zero, one or two scalars, but got 3/; - diag 'This will throw two warnings' if $] >= 5.008008 and $] < 5.009; + diag 'This will throw two warnings' if "$]" >= 5.008008 and "$]" < 5.009; local $@; eval q[ use Lexical::Types as => sub { qw }; @@ -117,7 +117,7 @@ use Test::More tests => 14 + 6; { my $expect = qr/^banana at \(eval \d+\) line 2/; - diag 'This will throw two more warnings' if $] >= 5.008008 and $] < 5.009; + diag 'This will throw two more warnings' if "$]" >= 5.008008 and "$]" < 5.009; local $@; eval q[ use Lexical::Types as => sub { die 'banana' }; diff --git a/t/13-padsv.t b/t/13-padsv.t index 0509260..ab042ae 100644 --- a/t/13-padsv.t +++ b/t/13-padsv.t @@ -34,7 +34,7 @@ sub Int::TYPEDSCALAR { push @lines, (caller(0))[2]; () } SKIP: { skip 'Broken with threaded perls before 5.8.4' => 1 - if $Config{useithreads} and $] < 5.008004; + if $Config{useithreads} and "$]" < 5.008004; use Lexical::Types as => sub { # In 5.10, this closure is compiled before hints are enabled, so no hintseval diff --git a/t/14-ro.t b/t/14-ro.t index c8e9f7d..bae8ccf 100644 --- a/t/14-ro.t +++ b/t/14-ro.t @@ -24,7 +24,7 @@ sub ro_re { } sub maybe_warn { - diag 'This will throw two warnings' if $] >= 5.008008 and $] < 5.009; + diag 'This will throw two warnings' if "$]" >= 5.008008 and "$]" < 5.009; } { @@ -38,7 +38,7 @@ sub maybe_warn { } SKIP: { - skip 'Kinda broken on old 5.8.x' => 1 if $] <= 5.008006; + skip 'Kinda broken on old 5.8.x' => 1 if "$]" <= 5.008006; maybe_warn(); local $@; eval q! diff --git a/t/16-scope.t b/t/16-scope.t index 08fabbb..9e858dc 100644 --- a/t/16-scope.t +++ b/t/16-scope.t @@ -39,7 +39,7 @@ use lib 't/lib'; ::is($z, __FILE__.':6', 'pragma in use at the end'); } TESTREQUIRED3 - @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if $] <= 5.008003; + @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if "$]" <= 5.008003; is $@, '', 'third require test didn\'t croak prematurely'; is_deeply \@w, [ ], 'third require test didn\'t warn'; is_deeply \@decls, [ map "Int3$_", qw ], diff --git a/t/30-threads.t b/t/30-threads.t index d48fa02..c616b76 100644 --- a/t/30-threads.t +++ b/t/30-threads.t @@ -16,7 +16,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; } use threads; @@ -67,7 +67,7 @@ EVALD SKIP: { skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3 - unless $] >= 5.010; + unless "$]" >= 5.010; eval <<'EVALD'; my Tag $t3; is $t3, $tid, "typed lexical correctly initialized in eval (propagated) at run $_ in thread $tid" diff --git a/t/31-threads-teardown.t b/t/31-threads-teardown.t index cd93a50..34e61ac 100644 --- a/t/31-threads-teardown.t +++ b/t/31-threads-teardown.t @@ -16,7 +16,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; } use threads; @@ -43,7 +43,7 @@ sub run_perl { SKIP: { - skip 'Fails on 5.8.2 and lower' => 1 if $] <= 5.008002; + skip 'Fails on 5.8.2 and lower' => 1 if "$]" <= 5.008002; my $status = run_perl <<' RUN'; { package IntX; package IntY; package IntZ; } diff --git a/t/lib/Lexical/Types/TestRequired2.pm b/t/lib/Lexical/Types/TestRequired2.pm index eb15065..5237071 100644 --- a/t/lib/Lexical/Types/TestRequired2.pm +++ b/t/lib/Lexical/Types/TestRequired2.pm @@ -15,7 +15,7 @@ Test::More::is($x, 't/lib/Lexical/Types/TestRequired2.pm:' . (__LINE__-1), 'prag eval q! my Int $y; my $desc = 'pragma in use in eval in require'; - if ($] < 5.009005) { + if ("$]" < 5.009005) { Test::More::is($y, undef, $desc); } else { Test::More::like($y, qr/^\(eval +\d+\):2$/, $desc);