X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI.pm;h=a7d6ddfaaf39aa07c4d99698475774e8495db569;hb=6ae3f335e1b67e8fdcb7b9a52cca64fd8c01af29;hp=14474a85d1c00e6e931ff006ff3a422cca1effe2;hpb=457c3335f7fba02629f65407ad3bf515fe90887a;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index 14474a8..a7d6ddf 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -5,7 +5,6 @@ use warnings; use base qw/DBIx::Class::Schema::Loader::Base/; use Class::C3; use Carp::Clan qw/^DBIx::Class/; -use UNIVERSAL::require; our $VERSION = '0.04999_07'; @@ -39,13 +38,13 @@ sub new { # rebless to vendor-specific class if it exists and loads my $dbh = $self->schema->storage->dbh; my $driver = $dbh->{Driver}->{Name}; + my $subclass = 'DBIx::Class::Schema::Loader::DBI::' . $driver; - $subclass->require; - if($@ && $@ !~ /^Can't locate /) { - croak "Failed to require $subclass: $@"; - } - elsif(!$@) { + if ($self->ensure_class_found($subclass)) { + eval { $self->ensure_class_loaded($subclass) }; + croak "Failed to load $subclass: $@" if $@; bless $self, $subclass unless $self->isa($subclass); + $self->_rebless(); } # Set up the default quoting character and name seperators @@ -71,6 +70,9 @@ sub new { # Override this in vendor modules to do things at the end of ->new() sub _setup { } +# Override this in vendor module to load a subclass if necessary +sub _rebless { } + # Returns an array of table names sub _tables_list { my $self = shift;