Skip to content

Commit

Permalink
At last a safer Moo (lots of kludges undone)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Mar 2, 2015
1 parent cff17b9 commit 0020e36
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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+

Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
22 changes: 1 addition & 21 deletions lib/DBIx/Class/Storage/BlockRunner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 1 addition & 21 deletions lib/DBIx/Class/Storage/Statistics.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
18 changes: 1 addition & 17 deletions lib/DBIx/Class/_Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 &quote_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 }
Expand Down
15 changes: 9 additions & 6 deletions t/lib/DBICTest/Util/LeakTracer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
}

Expand Down
7 changes: 0 additions & 7 deletions xt/extra/lean_startup.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ BEGIN {
namespace::clean
Try::Tiny
Sub::Name
strictures
Sub::Defer
Sub::Quote
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0020e36

Please sign in to comment.