[Bast-commits] r5908 - in
branches/DBIx-Class-Schema-Loader/current: .
lib/DBIx/Class/Schema lib/DBIx/Class/Schema/Loader
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Sun Apr 19 08:59:08 GMT 2009
Author: ilmari
Date: 2009-04-19 09:59:08 +0100 (Sun, 19 Apr 2009)
New Revision: 5908
Modified:
branches/DBIx-Class-Schema-Loader/current/Changes
branches/DBIx-Class-Schema-Loader/current/Makefile.PL
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm
Log:
Replace UNIVERSAL::require with Class::C3::Componentised
Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes 2009-04-19 07:38:51 UTC (rev 5907)
+++ branches/DBIx-Class-Schema-Loader/current/Changes 2009-04-19 08:59:08 UTC (rev 5908)
@@ -1,5 +1,8 @@
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).
Modified: branches/DBIx-Class-Schema-Loader/current/Makefile.PL
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Makefile.PL 2009-04-19 07:38:51 UTC (rev 5907)
+++ branches/DBIx-Class-Schema-Loader/current/Makefile.PL 2009-04-19 08:59:08 UTC (rev 5908)
@@ -13,13 +13,13 @@
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';
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-04-19 07:38:51 UTC (rev 5907)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-04-19 08:59:08 UTC (rev 5908)
@@ -2,7 +2,7 @@
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;
@@ -443,9 +443,9 @@
) {
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];
}
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm 2009-04-19 07:38:51 UTC (rev 5907)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm 2009-04-19 08:59:08 UTC (rev 5908)
@@ -5,7 +5,6 @@
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 @@
# 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 @@
# 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;
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm 2009-04-19 07:38:51 UTC (rev 5907)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm 2009-04-19 08:59:08 UTC (rev 5908)
@@ -4,7 +4,6 @@
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 /;
@@ -131,9 +130,8 @@
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;
More information about the Bast-commits
mailing list