From: Peter Rabbitson Date: Sun, 12 Oct 2014 10:23:10 +0000 (+0200) Subject: Stop lazy-requiring B and Storable in internal functions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d7d45bdc65;p=dbsrgits%2FDBIx-Class.git Stop lazy-requiring B and Storable in internal functions Almost every non-toy program will end up lazy-loading these anyway, so move their require to compile time. This also helps with load-patterns changing in SQLA and Moo, and failing t/53lean_startup.t on some smokers --- diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 053e0a5..e2a9bbf 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -53,7 +53,9 @@ BEGIN { # Carp::Skip to the rescue soon use DBIx::Class::Carp '^DBIx::Class|^DBICTest'; +use B (); use Carp 'croak'; +use Storable 'nfreeze'; use Scalar::Util qw(weaken blessed reftype); use List::Util qw(first); @@ -114,16 +116,14 @@ sub refdesc ($) { sub refcount ($) { croak "Expecting a reference" if ! length ref $_[0]; - require B; # No tempvars - must operate on $_[0], otherwise the pad # will count as an extra ref B::svref_2object($_[0])->REFCNT; } sub serialize ($) { - require Storable; local $Storable::canonical = 1; - Storable::nfreeze($_[0]); + nfreeze($_[0]); } sub is_exception ($) { diff --git a/t/53lean_startup.t b/t/53lean_startup.t index 525c46a..cb0697a 100644 --- a/t/53lean_startup.t +++ b/t/53lean_startup.t @@ -108,6 +108,7 @@ BEGIN { Scalar::Util List::Util + Storable Class::Accessor::Grouped Class::C3::Componentised