From: Chris Prather <chris@prather.org>
Date: Wed, 2 Jan 2008 20:52:13 +0000 (+0000)
Subject: move dbicadmin to JSON::Any
X-Git-Tag: v0.08010~23
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cfef6f5fc9c98e22dea0c059f3e551edc115960;p=dbsrgits%2FDBIx-Class.git

move dbicadmin to JSON::Any
---

diff --git a/Changes b/Changes
index f22d6bf..e008519 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@ Revision history for DBIx::Class
 
         - Added freeze, thaw and dclone methods to Schema so that thawed
           objects will get re-attached to the schema.
+        - Moved dbicadmin to JSON::Any wrapped JSON.pm for a sane API
 
 0.08008 2007-11-16 14:30:00
         - Fixed join merging bug (test from Zby)
diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm
index aa4ccaf..e4875e8 100644
--- a/lib/DBIx/Class.pm
+++ b/lib/DBIx/Class.pm
@@ -258,6 +258,8 @@ paulm: Paul Makepeace
 
 penguin: K J Cheetham
 
+perigrin: Chris Prather <chris@prather.org>
+
 phaylon: Robert Sedlacek <phaylon@dunkelheit.at>
 
 quicksilver: Jules Bean
diff --git a/script/dbicadmin b/script/dbicadmin
index 9eec9b7..a1476f6 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 qw(JSON);
 
-$JSON::BareKey = 1;
-$JSON::QuotApos = 1;
+
+my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1);
 
 GetOptions(
     'schema=s'  => \my $schema_class,
@@ -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,9 +59,9 @@ 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);