From: Eden Cardim Date: Fri, 7 May 2010 22:02:41 +0000 (+0000) Subject: I option functional and passing tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b13aab4ff956894c2dcfdfb2c1e1d8aa04cf635d;p=dbsrgits%2FDBIx-Class-Historic.git I option functional and passing tests --- diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm index 20a86b8..ab8309d 100644 --- a/lib/DBIx/Class/Admin.pm +++ b/lib/DBIx/Class/Admin.pm @@ -88,12 +88,25 @@ has 'schema' => ( sub _build_schema { my ($self) = @_; require Class::MOP; - Class::MOP::load_class($self->schema_class); - + { + local @INC = (@{$self->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} ); } +=head2 include_dirs + +Extra include directories to look when loading C + +=cut + +has 'include_dirs' => ( + is => 'rw', + isa => 'ArrayRef', + default => sub {[]} +); =head2 resultset diff --git a/script/dbicadmin b/script/dbicadmin index 1830cfa..52a5491 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -39,7 +39,7 @@ my ($opts, $usage) = describe_options( ['deploy' => 'Deploy the schema to the database',], ['select' => 'Select data from the schema', ], ['insert' => 'Insert data into the schema', ], - ['update' => 'Update data in the schema', ], + ['update' => 'Update data in the schema', ], ['delete' => 'Delete data from the schema',], ['op:s' => 'compatiblity option all of the above can be suppied as --op='], ['help' => 'display this help', { implies => { schema_class => '__dummy__' } } ], @@ -62,6 +62,7 @@ my ($opts, $usage) = describe_options( ['force' => 'Be forceful with some operations'], ['trace' => 'Turn on DBIx::Class trace output'], ['quiet' => 'Be less verbose'], + ['I:s@' => 'Same as perl\'s -I'] ) ); @@ -86,6 +87,10 @@ if($opts->{selfinject_pod}) { ); } +if($opts->{I}) { + $opts->{include} = delete $opts->{I}; +} + if($opts->{help}) { $usage->die(); } @@ -102,7 +107,7 @@ my $action = $opts->{action}; $action = $opts->{op} if ($action eq 'op'); -print "Performig action $action...\n"; +print "Performing action $action...\n"; my $res = $admin->$action(); if ($action eq 'select') {