From: Rafael Kitover <rkitover@cpan.org>
Date: Mon, 30 Nov 2009 00:18:50 +0000 (+0000)
Subject: load external classes for dynamic schemas only
X-Git-Tag: 0.04999_13~23^2~7
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd5f03fc5b441c84fb641589c472872d8e4c76ac;p=dbsrgits%2FDBIx-Class-Schema-Loader.git

load external classes for dynamic schemas only
---

diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm
index e8ee87b..6cd8368 100644
--- a/lib/DBIx/Class/Schema/Loader/Base.pm
+++ b/lib/DBIx/Class/Schema/Loader/Base.pm
@@ -438,13 +438,12 @@ sub _load_external {
     close($fh)
         or croak "Failed to close $real_inc_path: $!";
 
-# load the class too
-    {
+    if ($self->dynamic) { # load the class too
         # turn off redefined warnings
-        $SIG{__WARN__} = sub {};
+        local $SIG{__WARN__} = sub {};
         do $real_inc_path;
+        die $@ if $@;
     }
-    die $@ if $@;
 }
 
 =head2 load
diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm
index c15d322..c7a78de 100644
--- a/t/lib/dbixcsl_common_tests.pm
+++ b/t/lib/dbixcsl_common_tests.pm
@@ -134,7 +134,7 @@ sub setup_schema {
 
        exit if $file_count != $expected_count;
 
-       my $warn_count = 0;
+       my $warn_count = 2;
        $warn_count++ if grep /ResultSetManager/, @loader_warnings;
 
         if($self->{skip_rels}) {