More robust Moo import block (modelled on DBIC)
Peter Rabbitson [Wed, 24 Sep 2014 00:25:20 +0000 (02:25 +0200)]
lib/SQL/Abstract/Tree.pm

index d9b67f9..ecf950d 100644 (file)
@@ -5,9 +5,19 @@ package SQL::Abstract::Tree;
 BEGIN {
   require warnings;
   my $initial_fatal_bits = (${^WARNING_BITS}||'') & $warnings::DeadBits{all};
+
   local $ENV{PERL_STRICTURES_EXTRA} = 0;
-  require Moo; Moo->import;
-  require Sub::Quote; Sub::Quote->import('quote_sub');
+  # 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;
+  Sub::Quote->import('quote_sub');
   ${^WARNING_BITS} &= ( $initial_fatal_bits | ~ $warnings::DeadBits{all} );
 }
 # END pre-Moo2 import block