X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fdbicadmin;h=16e97fecdd2f11e3cbfb5bac3964757e8ac27e0c;hb=1239d14e2874c2209270d5388fd5055e348cf83f;hp=ba511ef42ff27dfc827dcd4e7fac3625d970c06c;hpb=82b0855476d6556d5d3a0ae6ae8c975be077c855;p=dbsrgits%2FDBIx-Class.git diff --git a/script/dbicadmin b/script/dbicadmin index ba511ef..16e97fe 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; @@ -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,12 +62,17 @@ 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, prepended to current @INC'], ) ); die "please only use one of --config or --connect-info\n" if ($opts->{config} and $opts->{connect_info}); if($opts->{selfinject_pod}) { + + die "This is an internal method, do not call!!!\n" + unless $ENV{MAKELEVEL}; + $usage->synopsis($synopsis_text); $usage->short_description($short_description); exec ( @@ -82,23 +87,27 @@ if($opts->{selfinject_pod}) { ); } +# FIXME - lowercasing will eventually go away when Getopt::Long::Descriptive is fixed +if($opts->{i}) { + require lib; + lib->import( @{delete $opts->{i}} ); +} + if($opts->{help}) { - $usage->die(); + $usage->die(); } # option compatability mangle if($opts->{connect}) { $opts->{connect_info} = delete $opts->{connect}; } - my $admin = DBIx::Class::Admin->new( %$opts ); - 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') {