Booted UNIVERSAL::require sideways out the codebase
Matt S Trout [Sat, 28 Jan 2006 15:29:48 +0000 (15:29 +0000)]
Build.PL
lib/DBIx/Class/Schema.pm

index db515d4..3b06ba2 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -8,7 +8,6 @@ my %arguments = (
     requires           => {
         'Data::Page'                => 2.00,
         'DBI'                       => 1.40,
-        'UNIVERSAL::require'        => 0,
         'Scalar::Util'              => 0,
         'SQL::Abstract'             => 1.20,
         'SQL::Abstract::Limit'      => 0.101,
@@ -18,7 +17,6 @@ my %arguments = (
         'Module::Find'              => 0,
         'Storable'                  => 0,
         'Class::Data::Accessor'     => 0.01,
-        # Following for CDBICompat only
        'Carp::Clan'                => 0,
     },
     recommends          => {
index cc6c949..c84e0a7 100644 (file)
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use Carp::Clan qw/^DBIx::Class/;
-use UNIVERSAL::require;
 
 use base qw/DBIx::Class/;
 
@@ -230,7 +229,9 @@ you expect.
 sub compose_connection {
   my ($self, $target, @info) = @_;
   my $base = 'DBIx::Class::ResultSetProxy';
-  $base->require;
+  eval "require ${base};";
+  $self->throw_exception("No arguments to load_classes and couldn't load".
+      " ${base} ($@)") if $@;
 
   if ($self eq $target) {
     # Pathological case, largely caused by the docs on early C::M::DBIC::Plain
@@ -311,7 +312,9 @@ sub connection {
   my $storage_class = $self->storage_type;
   $storage_class = 'DBIx::Class::Storage'.$storage_class
     if $storage_class =~ m/^::/;
-  $storage_class->require;
+  eval "require ${storage_class};";
+  $self->throw_exception("No arguments to load_classes and couldn't load".
+      " ${storage_class} ($@)") if $@;
   my $storage = $storage_class->new;
   $storage->connect_info(\@info);
   $self->storage($storage);