From: Peter Rabbitson Date: Mon, 20 Jun 2016 20:58:32 +0000 (+0200) Subject: Add 'PERL_VERSION' foldable constant, switch lib-ish things over X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3605497bcb83ef83a4859a84e52c03f77f3cd626;p=dbsrgits%2FDBIx-Class.git Add 'PERL_VERSION' foldable constant, switch lib-ish things over No point changing the many $] references in .t's themselves --- diff --git a/lib/DBIx/Class/ResultSource/RowParser/Util.pm b/lib/DBIx/Class/ResultSource/RowParser/Util.pm index 68f7e6b..a64df95 100644 --- a/lib/DBIx/Class/ResultSource/RowParser/Util.pm +++ b/lib/DBIx/Class/ResultSource/RowParser/Util.pm @@ -6,7 +6,7 @@ use warnings; use DBIx::Class::_Util qw( perlstring dump_value ); -use constant HAS_DOR => ( "$]" < 5.010 ? 0 : 1 ); +use constant HAS_DOR => ( ( DBIx::Class::_ENV_::PERL_VERSION < 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 dfa20c4..76f9b35 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -6,8 +6,6 @@ use DBIx::Class::StartupCheck; # load es early as we can, usually a noop use warnings; use strict; -use constant SPURIOUS_VERSION_CHECK_WARNINGS => ( "$]" < 5.010 ? 1 : 0); - my $mro_recursor_stack; BEGIN { @@ -17,18 +15,23 @@ BEGIN { use Config; use constant { + PERL_VERSION => "$]", + OS_NAME => "$^O", + }; + + use constant { # but of course - BROKEN_FORK => ($^O eq 'MSWin32') ? 1 : 0, + BROKEN_FORK => (OS_NAME eq 'MSWin32') ? 1 : 0, - BROKEN_GOTO => ( "$]" < 5.008003 ) ? 1 : 0, + BROKEN_GOTO => ( PERL_VERSION < 5.008003 ) ? 1 : 0, # perl -MScalar::Util=weaken -e 'weaken( $hash{key} = \"value" )' - BROKEN_WEAK_SCALARREF_VALUES => ( "$]" < 5.008003 ) ? 1 : 0, + BROKEN_WEAK_SCALARREF_VALUES => ( PERL_VERSION < 5.008003 ) ? 1 : 0, HAS_ITHREADS => $Config{useithreads} ? 1 : 0, - UNSTABLE_DOLLARAT => ( "$]" < 5.013002 ) ? 1 : 0, + UNSTABLE_DOLLARAT => ( PERL_VERSION < 5.013002 ) ? 1 : 0, ( map # @@ -47,11 +50,9 @@ BEGIN { ), IV_SIZE => $Config{ivsize}, - - OS_NAME => $^O, }; - if ( "$]" < 5.009_005) { + if ( PERL_VERSION < 5.009_005) { require MRO::Compat; constant->import( OLD_MRO => 1 ); @@ -149,6 +150,8 @@ BEGIN { sub PEEPEENESS () { &$sigh } } +use constant SPURIOUS_VERSION_CHECK_WARNINGS => ( DBIx::Class::_ENV_::PERL_VERSION < 5.010 ? 1 : 0); + # FIXME - this is not supposed to be here # Carp::Skip to the rescue soon use DBIx::Class::Carp '^DBIx::Class|^DBICTest'; diff --git a/t/lib/DBICTest/Util.pm b/t/lib/DBICTest/Util.pm index 46b8c2f..dc34406 100644 --- a/t/lib/DBICTest/Util.pm +++ b/t/lib/DBICTest/Util.pm @@ -5,7 +5,11 @@ use strict; use ANFANG; -use DBICTest::RunMode; +use Config; +use Carp qw(cluck confess croak); +use Fcntl qw( :DEFAULT :flock ); +use Scalar::Util qw( blessed refaddr openhandle ); +use DBIx::Class::_Util qw( scope_guard parent_dir ); use constant { @@ -19,20 +23,20 @@ use constant { # add an escape for these perls ON SMOKERS - a user/CI will still get death # constname a homage to http://theoatmeal.com/comics/working_home PEEPEENESS => ( + ( + DBIx::Class::_ENV_::PERL_VERSION >= 5.013005 + and + DBIx::Class::_ENV_::PERL_VERSION <= 5.013006 + ) + and + require DBICTest::RunMode + and DBICTest::RunMode->is_smoker and ! DBICTest::RunMode->is_ci - and - ( "$]" >= 5.013005 and "$]" <= 5.013006) ), }; -use Config; -use Carp qw(cluck confess croak); -use Fcntl qw( :DEFAULT :flock ); -use Scalar::Util qw( blessed refaddr openhandle ); -use DBIx::Class::_Util qw( scope_guard parent_dir ); - use base 'Exporter'; our @EXPORT_OK = qw( dbg stacktrace class_seems_loaded