From: Peter Rabbitson Date: Fri, 9 Oct 2015 10:04:45 +0000 (+0200) Subject: Stop using bare $] throughout - protects the codebase from floating point hell X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=750a4ad26c8fbe0f513a3abd4a9cb79ef8f40884;p=dbsrgits%2FDBIx-Class.git Stop using bare $] throughout - protects the codebase from floating point hell Issues similar, but likely not limited to, P5#72210 ( see prev commit) --- diff --git a/Changes b/Changes index e39994c..f5b552f 100644 --- a/Changes +++ b/Changes @@ -39,6 +39,8 @@ Revision history for DBIx::Class Optional::Dependencies::req_group_list (no known users in the wild) - Protect tests and codebase from incomplete caller() overrides, like e.g. RT#32640 + - Stop using bare $] throughout - protects the codebase from issues + similar (but likely not limited to) P5#72210 0.082820 2015-03-20 20:35 (UTC) * Fixes diff --git a/lib/DBIx/Class/ResultSource/RowParser/Util.pm b/lib/DBIx/Class/ResultSource/RowParser/Util.pm index 6ef7589..a20d07c 100644 --- a/lib/DBIx/Class/ResultSource/RowParser/Util.pm +++ b/lib/DBIx/Class/ResultSource/RowParser/Util.pm @@ -7,7 +7,7 @@ use warnings; use List::Util 'first'; use DBIx::Class::_Util 'perlstring'; -use constant HAS_DOR => ( $] < 5.010 ? 0 : 1 ); +use constant HAS_DOR => ( "$]" < 5.010 ? 0 : 1 ); use base 'Exporter'; our @EXPORT_OK = qw( diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 4829539..58e9e6a 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use warnings; use strict; -use constant SPURIOUS_VERSION_CHECK_WARNINGS => ($] < 5.010 ? 1 : 0); +use constant SPURIOUS_VERSION_CHECK_WARNINGS => ( "$]" < 5.010 ? 1 : 0); BEGIN { package # hide from pause @@ -17,7 +17,7 @@ BEGIN { # but of course BROKEN_FORK => ($^O eq 'MSWin32') ? 1 : 0, - BROKEN_GOTO => ($] < '5.008003') ? 1 : 0, + BROKEN_GOTO => ( "$]" < 5.008003 ) ? 1 : 0, HAS_ITHREADS => $Config{useithreads} ? 1 : 0, @@ -25,7 +25,7 @@ BEGIN { # During 5.13 dev cycle HELEMs started to leak on copy # add an escape for these perls ON SMOKERS - a user will still get death - PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ($] >= 5.013005 and $] <= 5.013006) ), + PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ( "$]" >= 5.013005 and "$]" <= 5.013006) ), SHUFFLE_UNORDERED_RESULTSETS => $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} ? 1 : 0, @@ -42,7 +42,7 @@ BEGIN { OS_NAME => $^O, }; - if ($] < 5.009_005) { + if ( "$]" < 5.009_005) { require MRO::Compat; constant->import( OLD_MRO => 1 ); } diff --git a/maint/Makefile.PL.inc/12_authordeps.pl b/maint/Makefile.PL.inc/12_authordeps.pl index 398722e..e83e03d 100644 --- a/maint/Makefile.PL.inc/12_authordeps.pl +++ b/maint/Makefile.PL.inc/12_authordeps.pl @@ -39,7 +39,7 @@ EOW grep { !/^rdbms_|^dist_/ and - ($] > 5.008002 or !/^ (?: test_ )? (?: admin | admin_script | replicated ) $/x ) + ( "$]" > 5.008002 or !/^ (?: test_ )? (?: admin | admin_script | replicated ) $/x ) } keys %{DBIx::Class::Optional::Dependencies->req_group_list} ]); diff --git a/t/00describe_environment.t b/t/00describe_environment.t index 82f2fdb..f3a76b2 100644 --- a/t/00describe_environment.t +++ b/t/00describe_environment.t @@ -14,7 +14,7 @@ BEGIN { BEGIN { unshift @INC, 't/lib'; - if ($] < 5.010) { + if ( "$]" < 5.010) { # Pre-5.10 perls pollute %INC on unsuccesfull module # require, making it appear as if the module is already diff --git a/t/51threadnodb.t b/t/51threadnodb.t index dd1a501..3af78d5 100644 --- a/t/51threadnodb.t +++ b/t/51threadnodb.t @@ -21,10 +21,10 @@ use lib qw(t/lib); use DBICTest; plan skip_all => 'DBIC does not actively support threads before perl 5.8.5' - if $] < '5.008005'; + if "$]" < 5.008005; plan skip_all => 'Potential problems on Win32 Perl < 5.14 and Variable::Magic - investigation pending' - if $^O eq 'MSWin32' && $] < 5.014 && DBICTest::RunMode->is_plain; + if $^O eq 'MSWin32' && "$]" < 5.014 && DBICTest::RunMode->is_plain; # README: If you set the env var to a number greater than 10, # we will use that many children diff --git a/t/51threads.t b/t/51threads.t index b16fe2c..ae3addc 100644 --- a/t/51threads.t +++ b/t/51threads.t @@ -21,7 +21,7 @@ use Test::More; use Test::Exception; plan skip_all => 'DBIC does not actively support threads before perl 5.8.5' - if $] < '5.008005'; + if "$]" < 5.008005; use lib qw(t/lib); use DBICTest; diff --git a/t/51threadtxn.t b/t/51threadtxn.t index 368c9e1..e74c7c1 100644 --- a/t/51threadtxn.t +++ b/t/51threadtxn.t @@ -23,7 +23,7 @@ use warnings; use Test::More; plan skip_all => 'DBIC does not actively support threads before perl 5.8.5' - if $] < '5.008005'; + if "$]" < 5.008005; use Scalar::Util 'weaken'; use lib qw(t/lib); diff --git a/t/resultset/rowparser_internals.t b/t/resultset/rowparser_internals.t index 9d38e90..e89369f 100644 --- a/t/resultset/rowparser_internals.t +++ b/t/resultset/rowparser_internals.t @@ -897,7 +897,7 @@ sub is_same_src { SKIP: { my ($got, $expect) = @_; skip "Not testing equality of source containing defined-or operator on this perl $]", 1 - if ($] < 5.010 and$expect =~ m!\Q//=!); + if ( "$]" < 5.010 and $expect =~ m!\Q//=! ); $expect =~ s/__NBC__/perlstring($DBIx::Class::ResultSource::RowParser::Util::null_branch_class)/ge; diff --git a/t/storage/txn_scope_guard.t b/t/storage/txn_scope_guard.t index 8213a44..d7e4cd0 100644 --- a/t/storage/txn_scope_guard.t +++ b/t/storage/txn_scope_guard.t @@ -106,7 +106,7 @@ use DBICTest; #$schema->storage->_dbh( $schema->storage->_dbh->clone ); die 'Deliberate exception'; - }, ($] >= 5.013008 ) + }, ( "$]" >= 5.013008 ) ? qr/Deliberate exception/s # temporary until we get the generic exception wrapper rolling : qr/Deliberate exception.+Rollback failed/s ); @@ -179,7 +179,7 @@ for my $post_poison (0,1) { ! $pre_poison or # I do not understand why but on <= 5.8.8 and on 5.10.0 "$pre_poison && $post_poison" passes... - ($] > 5.008008 and $] < 5.010000 ) or $] > 5.010000 + ( "$]" > 5.008008 and "$]" < 5.010000 ) or "$]" > 5.010000 )); is (@w, 2, "Both expected warnings found - \$\@ pre-poison: $pre_poison, post-poison: $post_poison" ); diff --git a/t/zzzzzzz_perl_perf_bug.t b/t/zzzzzzz_perl_perf_bug.t index c1e0ab8..4434e1c 100644 --- a/t/zzzzzzz_perl_perf_bug.t +++ b/t/zzzzzzz_perl_perf_bug.t @@ -99,7 +99,7 @@ SKIP: { } sub _possibly_has_bad_overload_performance { - return $] < 5.008009 && !_has_bug_34925(); + return( "$]" < 5.008009 and !_has_bug_34925() ); } # If this next one fails then you almost certainly have a RH derived diff --git a/xt/extra/c3_mro.t b/xt/extra/c3_mro.t index 0b7314c..55effb5 100644 --- a/xt/extra/c3_mro.t +++ b/xt/extra/c3_mro.t @@ -67,7 +67,7 @@ is ( 'Correct method picked' ); -if ($] >= 5.010) { +if ( "$]" >= 5.010 ) { ok (! $INC{'Class/C3.pm'}, 'No Class::C3 loaded on perl 5.10+'); # Class::C3::Componentised loads MRO::Compat unconditionally to satisfy diff --git a/xt/extra/internals/namespaces_cleaned.t b/xt/extra/internals/namespaces_cleaned.t index 92185ae..552a81e 100644 --- a/xt/extra/internals/namespaces_cleaned.t +++ b/xt/extra/internals/namespaces_cleaned.t @@ -1,5 +1,5 @@ BEGIN { - if ($] < 5.010) { + if ( "$]" < 5.010) { # Pre-5.10 perls pollute %INC on unsuccesfull module # require, making it appear as if the module is already diff --git a/xt/extra/lean_startup.t b/xt/extra/lean_startup.t index 5995324..9675ef0 100644 --- a/xt/extra/lean_startup.t +++ b/xt/extra/lean_startup.t @@ -72,7 +72,7 @@ BEGIN { if $ENV{PERL5OPT}; plan skip_all => 'Dependency load patterns are radically different before perl 5.10' - if $] < 5.010; + if "$]" < 5.010; # add what we loaded so far for (keys %INC) {