perl modules shouldnt munge @INC; thats the job of the script
Arthur Axel "fREW" Schmidt [Wed, 2 Jun 2010 05:05:39 +0000 (05:05 +0000)]
lib/DBIx/Class/Admin.pm
script/dbicadmin

index be90ae1..7052fbf 100644 (file)
@@ -85,33 +85,15 @@ 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;
+  Class::MOP::load_class($self->schema_class);
   $self->connect_info->[3]{ignore_version} = 1;
   return $self->schema_class->connect(@{$self->connect_info});
 }
 
-=head2 include_dirs
-
-Extra include directories to look when loading C<schema_class>
-
-=cut
-
-has 'include_dirs' => (
-    is => 'rw',
-    isa => 'ArrayRef',
-    default => sub {[]}
-);
-
 =head2 resultset
 
 a resultset from the schema to operate on
index c2b9ccf..6ab9d09 100755 (executable)
@@ -14,6 +14,7 @@ BEGIN {
 use DBIx::Class::Admin::Descriptive;
 #use Getopt::Long::Descriptive;
 use DBIx::Class::Admin;
+require lib;
 
 my $short_description = "utility for administrating DBIx::Class schemata";
 my $synopsis_text =q|
@@ -89,7 +90,7 @@ if($opts->{selfinject_pod}) {
 
 # FIXME - lowercasing will eventually go away when Getopt::Long::Descriptive is fixed
 if($opts->{i}) {
-    $opts->{include_dirs} = delete $opts->{i};
+    lib->import(delete $opts->{i});
 }
 
 if($opts->{help}) {