From: Peter Rabbitson Date: Mon, 22 Aug 2016 11:19:41 +0000 (+0200) Subject: Centralize loading of DBIx::Class::Exception X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b78ed1e42494c2d9afc81d24cc9b67563fe135e0;p=dbsrgits%2FDBIx-Class.git Centralize loading of DBIx::Class::Exception No functional, nor even load-order changes --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index bdcc960..cdcbcbb 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -21,7 +21,6 @@ $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev relea use mro 'c3'; use base qw/DBIx::Class::Componentised DBIx::Class::AccessorGroup/; -use DBIx::Class::Exception; __PACKAGE__->mk_classaccessor( _skip_namespace_frames => join( '|', map { '^' . $_ } qw( diff --git a/lib/DBIx/Class/Schema/SanityChecker.pm b/lib/DBIx/Class/Schema/SanityChecker.pm index b048edd..61936d9 100644 --- a/lib/DBIx/Class/Schema/SanityChecker.pm +++ b/lib/DBIx/Class/Schema/SanityChecker.pm @@ -8,7 +8,6 @@ use DBIx::Class::_Util qw( describe_class_methods emit_loud_diag ); use DBIx::Class (); -use DBIx::Class::Exception (); use Scalar::Util qw( blessed refaddr ); use namespace::clean; diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index c8f0180..acae96a 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -6,10 +6,10 @@ use warnings; use base qw/DBIx::Class/; use mro 'c3'; -{ - package # Hide from PAUSE - DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION; - use base 'DBIx::Class::Exception'; +BEGIN { + no warnings 'once'; + @DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION::ISA + = 'DBIx::Class::Exception'; } use DBIx::Class::Carp; diff --git a/lib/DBIx/Class/Storage/BlockRunner.pm b/lib/DBIx/Class/Storage/BlockRunner.pm index 9d191c8..63f5be3 100644 --- a/lib/DBIx/Class/Storage/BlockRunner.pm +++ b/lib/DBIx/Class/Storage/BlockRunner.pm @@ -4,7 +4,6 @@ package # hide from pause until we figure it all out use warnings; use strict; -use DBIx::Class::Exception; use DBIx::Class::Carp; use Context::Preserve 'preserve_context'; use DBIx::Class::_Util qw( is_exception qsub dbic_internal_try ); diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 7d4a407..7d26850 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -1,7 +1,8 @@ package # hide from PAUSE DBIx::Class::_Util; -use DBIx::Class::StartupCheck; # load es early as we can, usually a noop +# load es early as we can, usually a noop +use DBIx::Class::StartupCheck; use warnings; use strict; @@ -173,6 +174,9 @@ use constant SPURIOUS_VERSION_CHECK_WARNINGS => ( DBIx::Class::_ENV_::PERL_VERSI # Carp::Skip to the rescue soon use DBIx::Class::Carp '^DBIx::Class|^DBICTest'; +# Ensure it is always there, in case we need to do a $schema-less throw() +use DBIx::Class::Exception (); + use B (); use Carp 'croak'; use Storable 'nfreeze'; diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 4ca3f93..ff63694 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -16,7 +16,6 @@ use Exporter; use SQL::Translator::Utils qw(debug normalize_name); use DBIx::Class::Carp qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/; use DBIx::Class::_Util 'dbic_internal_try'; -use DBIx::Class::Exception; use Class::C3::Componentised; use Scalar::Util 'blessed'; use Try::Tiny; diff --git a/xt/dist/loadable_standalone_testschema_resultclasses.t b/xt/dist/loadable_standalone_testschema_resultclasses.t index 95dd24f..5a9c6f6 100644 --- a/xt/dist/loadable_standalone_testschema_resultclasses.t +++ b/xt/dist/loadable_standalone_testschema_resultclasses.t @@ -15,7 +15,7 @@ use File::Find; my $worker = sub { my $fn = shift; - if (my @offenders = grep { $_ !~ m{DBIx/Class/(?:_Util|Carp|StartupCheck)\.pm} } grep { $_ =~ /(^|\/)DBI/ } keys %INC) { + if (my @offenders = grep { $_ !~ m{DBIx/Class/(?:_Util|Carp|Exception|StartupCheck)\.pm} } grep { $_ =~ /(^|\/)DBI/ } keys %INC) { die "Wtf - DBI* modules present in %INC: @offenders"; }