From: Peter Rabbitson Date: Thu, 26 Feb 2015 16:47:29 +0000 (+0100) Subject: At last a safer Moo (lots of kludges undone) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0020e364ef2847a723dd8bc538ee1ce632fd734c;p=dbsrgits%2FDBIx-Class.git At last a safer Moo (lots of kludges undone) --- diff --git a/Changes b/Changes index d94a1fd..0e8ea0a 100644 --- a/Changes +++ b/Changes @@ -23,7 +23,7 @@ Revision history for DBIx::Class Optional::Dependencies::req_group_list (no known users in the wild) - Depend on newer SQL::Abstract (fixing overly-aggressive parenthesis opener: RT#99503) - - Depend on newer Moo, fixing some interoperability issues: + - Depend on newer Moo, fixing some interoperability issues: RT#93004 and http://lists.scsys.co.uk/pipermail/dbix-class/2014-October/011787.html - Fix intermittent failures in the LeakTracer on 5.18+ diff --git a/Makefile.PL b/Makefile.PL index 03de9d1..e90e04b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -62,7 +62,7 @@ my $runtime_requires = { 'Data::Page' => '2.00', 'Devel::GlobalDestruction' => '0.09', 'Hash::Merge' => '0.12', - 'Moo' => '1.006001', + 'Moo' => '2.000', 'MRO::Compat' => '0.12', 'Module::Find' => '0.07', 'namespace::clean' => '0.24', diff --git a/lib/DBIx/Class/Storage/BlockRunner.pm b/lib/DBIx/Class/Storage/BlockRunner.pm index d7fe5d2..be29701 100644 --- a/lib/DBIx/Class/Storage/BlockRunner.pm +++ b/lib/DBIx/Class/Storage/BlockRunner.pm @@ -10,27 +10,7 @@ use Context::Preserve 'preserve_context'; use DBIx::Class::_Util qw(is_exception qsub); use Scalar::Util qw(weaken blessed reftype); use Try::Tiny; - -# DO NOT edit away without talking to riba first, he will just put it back -# BEGIN pre-Moo2 import block -BEGIN { - my $initial_fatal_bits = (${^WARNING_BITS}||'') & $warnings::DeadBits{all}; - - local $ENV{PERL_STRICTURES_EXTRA} = 0; - # load all of these now, so that lazy-loading does not escape - # the current PERL_STRICTURES_EXTRA setting - require Sub::Quote; - require Sub::Defer; - require Moo; - require Moo::Object; - require Method::Generate::Accessor; - require Method::Generate::Constructor; - - Moo->import; - ${^WARNING_BITS} &= ( $initial_fatal_bits | ~ $warnings::DeadBits{all} ); -} -# END pre-Moo2 import block - +use Moo; use namespace::clean; =head1 NAME diff --git a/lib/DBIx/Class/Storage/Statistics.pm b/lib/DBIx/Class/Storage/Statistics.pm index 7b0193d..42137bf 100644 --- a/lib/DBIx/Class/Storage/Statistics.pm +++ b/lib/DBIx/Class/Storage/Statistics.pm @@ -5,27 +5,7 @@ use warnings; use DBIx::Class::_Util qw(sigwarn_silencer qsub); use IO::Handle (); - -# DO NOT edit away without talking to riba first, he will just put it back -# BEGIN pre-Moo2 import block -BEGIN { - my $initial_fatal_bits = (${^WARNING_BITS}||'') & $warnings::DeadBits{all}; - - local $ENV{PERL_STRICTURES_EXTRA} = 0; - # load all of these now, so that lazy-loading does not escape - # the current PERL_STRICTURES_EXTRA setting - require Sub::Quote; - require Sub::Defer; - require Moo; - require Moo::Object; - require Method::Generate::Accessor; - require Method::Generate::Constructor; - - Moo->import; - ${^WARNING_BITS} &= ( $initial_fatal_bits | ~ $warnings::DeadBits{all} ); -} -# END pre-Moo2 import block - +use Moo; extends 'DBIx::Class'; use namespace::clean; diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 56bcbd6..33b296c 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -62,23 +62,7 @@ use Carp 'croak'; use Storable 'nfreeze'; use Scalar::Util qw(weaken blessed reftype); use List::Util qw(first); - -# DO NOT edit away without talking to riba first, he will just put it back -# BEGIN pre-Moo2 import block -BEGIN { - my $initial_fatal_bits = (${^WARNING_BITS}||'') & $warnings::DeadBits{all}; - - local $ENV{PERL_STRICTURES_EXTRA} = 0; - # load all of these now, so that lazy-loading does not escape - # the current PERL_STRICTURES_EXTRA setting - require Sub::Quote; - require Sub::Defer; - - Sub::Quote->import('quote_sub'); - ${^WARNING_BITS} &= ( $initial_fatal_bits | ~ $warnings::DeadBits{all} ); -} -sub qsub ($) { goto "e_sub } # no point depping on new Moo just for this -# END pre-Moo2 import block +use Sub::Quote qw(qsub quote_sub); # Already correctly prototyped: perlbrew exec perl -MStorable -e 'warn prototype \&Storable::dclone' BEGIN { *deep_clone = \&Storable::dclone } diff --git a/t/lib/DBICTest/Util/LeakTracer.pm b/t/lib/DBICTest/Util/LeakTracer.pm index 1f2caf5..5b1c80d 100644 --- a/t/lib/DBICTest/Util/LeakTracer.pm +++ b/t/lib/DBICTest/Util/LeakTracer.pm @@ -356,20 +356,23 @@ END { $tb->note("Auto checked $refs_traced references for leaks - none detected"); } -# Disable this until better times - SQLT and probably other things -# still load strictures. Let's just wait until Moo2.0 and go from there -=begin for tears # also while we are here and not in plain runmode: make sure we never # loaded any of the strictures XS bullshit (it's a leak in a sense) - unless (DBICTest::RunMode->is_plain) { + unless ( + $ENV{MOO_FATAL_WARNINGS} + or + # FIXME - SQLT loads strictures explicitly, /facedesk + # remove this INC check when 0fb58589 and 45287c815 are rectified + $INC{'SQL/Translator.pm'} + or + DBICTest::RunMode->is_plain + ) { for (qw(indirect multidimensional bareword::filehandles)) { exists $INC{ Module::Runtime::module_notional_filename($_) } and $tb->ok(0, "$_ load should not have been attempted!!!" ) } } -=cut - } } diff --git a/xt/extra/lean_startup.t b/xt/extra/lean_startup.t index 034351e..94c4ef2 100644 --- a/xt/extra/lean_startup.t +++ b/xt/extra/lean_startup.t @@ -103,7 +103,6 @@ BEGIN { namespace::clean Try::Tiny Sub::Name - strictures Sub::Defer Sub::Quote @@ -172,12 +171,6 @@ BEGIN { assert_no_missing_expected_requires(); } -# make sure we never loaded any of the strictures XS bullshit -{ - ok( ! exists $INC{ Module::Runtime::module_notional_filename($_) }, "$_ load never attempted" ) - for qw(indirect multidimensional bareword::filehandles); -} - done_testing; sub register_lazy_loadable_requires {