Revision history for Perl extension DBIx::Class::Schema::Loader
+0.04999_08 Not Yet Released
+ - Replace UNIVERSAL::require with Class::C3::Componentised
+
0.04999_07 2009-04-18
- Add result_base_class and schema_base_class options (RT #43977)
- Ignore duplicate uniq indices (including duplicates of the PK).
requires 'File::Spec' => 0;
requires 'Scalar::Util' => 0;
requires 'Data::Dump' => '1.06';
-requires 'UNIVERSAL::require' => '0.11';
requires 'Lingua::EN::Inflect::Number' => '1.1';
requires 'Text::Balanced' => 0;
requires 'Digest::MD5' => '2.36';
requires 'Class::Accessor::Fast' => '0.30';
requires 'Class::Data::Accessor' => '0.03';
requires 'Class::C3' => '0.18';
+requires 'Class::C3::Componentised' => 0;
requires 'Carp::Clan' => 0;
requires 'Class::Inspector' => 0;
requires 'DBIx::Class' => '0.07006';
use warnings;
use base qw/DBIx::Class::Schema Class::Data::Accessor/;
use Carp::Clan qw/^DBIx::Class/;
-use UNIVERSAL::require;
use Class::C3;
use Scalar::Util qw/ weaken /;
my $impl = $self->loader_class
|| "DBIx::Class::Schema::Loader" . $self->storage_type;
$impl = "DBIx::Class::Schema::Loader${impl}" if $impl =~ /^::/;
- $impl->require or
- croak qq/Could not load storage_type loader "$impl": / .
- qq/"$UNIVERSAL::require::ERROR"/;
+ eval { $self->ensure_class_loaded($impl) };
+ croak qq/Could not load storage_type loader "$impl": "$@"/ if $@;
$self->_loader($impl->new(%$args));
$self->_loader->load;
use strict;
use warnings;
-use base qw/Class::Accessor::Fast/;
+use base qw/Class::Accessor::Fast Class::C3::Componentised/;
use Class::C3;
use Carp::Clan qw/^DBIx::Class/;
use DBIx::Class::Schema::Loader::RelBuilder;
) {
my $has_file = Class::Inspector->loaded_filename($resultset_class);
Class::Unload->unload($resultset_class);
- $self->schema->ensure_class_loaded($resultset_class) if $has_file;
+ $self->ensure_class_loaded($resultset_class) if $has_file;
}
- $self->schema->ensure_class_loaded($class);
+ $self->ensure_class_loaded($class);
}
push @to_register, [$moniker, $class];
}
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';
# 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
# 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;