X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fdbicadmin;h=d6c8ecd3f065dee7679c1bae8f909731a5ad08cd;hb=993fd91cb2f1d2e2c5d55fc434fec0ca3a20713e;hp=9eec9b7e0881cceabcc4deeeb6fcfe5ff0c866d4;hpb=3e6fb1021178baa133c85f35c7ed89a9ae91bca9;p=dbsrgits%2FDBIx-Class.git diff --git a/script/dbicadmin b/script/dbicadmin index 9eec9b7..d6c8ecd 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -4,10 +4,10 @@ use warnings; use Getopt::Long; use Pod::Usage; -use JSON qw( jsonToObj ); +use JSON::Any; -$JSON::BareKey = 1; -$JSON::QuotApos = 1; + +my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1); GetOptions( 'schema=s' => \my $schema_class, @@ -30,7 +30,7 @@ if ($t_libs) { } pod2usage(1) if ($help); -$ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} = 1 if ($trace); +$ENV{DBIC_TRACE} = 1 if ($trace); die('No op specified') if(!$op); die('Invalid op') if ($op!~/^insert|update|delete|select$/s); @@ -50,7 +50,7 @@ if ($op eq 'select') { die('No schema specified') if(!$schema_class); eval("require $schema_class"); die('Unable to load schema') if ($@); -$connect = jsonToObj( $connect ) if ($connect); +$connect = $json->jsonToObj( $connect ) if ($connect); my $schema = $schema_class->connect( ( $connect ? @$connect : () ) ); @@ -59,15 +59,15 @@ die('No class specified') if(!$resultset_class); my $resultset = eval{ $schema->resultset($resultset_class) }; die('Unable to load the class with the schema') if ($@); -$set = jsonToObj( $set ) if ($set); -$where = jsonToObj( $where ) if ($where); -$attrs = jsonToObj( $attrs ) if ($attrs); +$set = $json->jsonToObj( $set ) if ($set); +$where = $json->jsonToObj( $where ) if ($where); +$attrs = $json->jsonToObj( $attrs ) if ($attrs); if ($op eq 'insert') { die('Do not use the where option with the insert op') if ($where); die('Do not use the attrs option with the insert op') if ($attrs); my $obj = $resultset->create( $set ); - print ''.ref($resultset).' ID: '.join(',',$obj->id())."\n"; + print ''.ref($resultset).' ID: '.join(',',$obj->id())."\n" if (!$quiet); } elsif ($op eq 'update') { $resultset = $resultset->search( ($where||{}) );