From: Arthur Axel "fREW" Schmidt <frioux@gmail.com>
Date: Tue, 1 Jun 2010 01:35:36 +0000 (+0000)
Subject: do not lazily set up include dirs and do not localize
X-Git-Tag: v0.08122~39
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c96bbc2af39d797ecdc5c6cdb273537afb4b2ba;p=dbsrgits%2FDBIx-Class.git

do not lazily set up include dirs and do not localize
---

diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm
index 25d2457..be90ae1 100644
--- a/lib/DBIx/Class/Admin.pm
+++ b/lib/DBIx/Class/Admin.pm
@@ -85,16 +85,19 @@ has 'schema' => (
   lazy_build  => 1,
 );
 
+sub BUILD {
+   my $self = shift;
+   require Class::MOP;
+
+   my @include_dirs = @{$self->include_dirs};
+   @INC = (@include_dirs, @INC);
+   Class::MOP::load_class($self->schema_class);
+}
+
 sub _build_schema {
   my ($self)  = @_;
-  require Class::MOP;
-  {
-    my @include_dirs = @{$self->include_dirs};
-    local @INC = (@include_dirs, @INC);
-    Class::MOP::load_class($self->schema_class);
-  }
-  $self->connect_info->[3]->{ignore_version} =1;
-  return $self->schema_class->connect(@{$self->connect_info()} ); # ,  $self->connect_info->[3], { ignore_version => 1} );
+  $self->connect_info->[3]{ignore_version} = 1;
+  return $self->schema_class->connect(@{$self->connect_info});
 }
 
 =head2 include_dirs
diff --git a/t/03podcoverage.t b/t/03podcoverage.t
index 095a2d2..eb08157 100644
--- a/t/03podcoverage.t
+++ b/t/03podcoverage.t
@@ -23,7 +23,7 @@ unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') )
 # of what this is doing might be in order.
 # The exceptions structure below is a hash keyed by the module
 # name. Any * in a name is treated like a wildcard and will behave
-# as expected. Modules are matched by longest string first, so 
+# as expected. Modules are matched by longest string first, so
 # A::B::C will match even if there is A::B*
 
 # The value for each is a hash, which contains one or more
@@ -88,6 +88,12 @@ my $exceptions = {
         /]
     },
 
+    'DBIx::Class::Admin'        => {
+        ignore => [ qw/
+            BUILD
+        /]
+     },
+
     'DBIx::Class::Storage::DBI::Replicated*'        => {
         ignore => [ qw/
             connect_call_do_sql