Switched from JSON to YAML::Syck
Sebastian Riedel [Wed, 25 Jan 2006 10:39:09 +0000 (10:39 +0000)]
Changes
Makefile.PL
lib/Catalyst.pm
lib/Catalyst/Helper.pm

diff --git a/Changes b/Changes
index 5af7395..2f33db4 100644 (file)
--- a/Changes
+++ b/Changes
@@ -2,7 +2,7 @@ This file documents the revision history for Perl extension Catalyst.
 
 5.64
 
-        - Switched to JSON from YAML for the default config file
+        - Switched to YAML::Syck
 
 5.63
         - Updated prereq versions
index 83d51a1..3b246d5 100644 (file)
@@ -33,7 +33,7 @@ requires 'URI' => 1.35;
 requires 'File::Copy::Recursive';
 requires 'Module::Install::Admin' => '0.54';
 requires 'Module::Install'        => '0.54';
-requires 'JSON';
+requires 'YAML::Syck'             => '0.28';
 requires 'File::Slurp';
 
 feature 'Apache/mod_perl Support',
index 00e62fa..5a91f46 100644 (file)
@@ -21,7 +21,7 @@ use Scalar::Util qw/weaken/;
 use Tree::Simple qw/use_weak_refs/;
 use Tree::Simple::Visitor::FindByUID;
 use attributes;
-use JSON;
+use YAML::Syck;
 use File::Slurp;
 
 __PACKAGE__->mk_accessors(
@@ -449,12 +449,11 @@ Returns or takes a hashref containing the application's configuration.
 
     __PACKAGE__->config({ db => 'dsn:SQLite:foo.db' });
 
-You can also use a L<JSON> config file like myapp.json in your
+You can also use a L<YAML> config file like myapp.json in your
 applications home directory.
 
-    {
-        "db": "dsn:SQLite:foo.db"
-    }
+    ---
+    db: dsn:SQLite:foo.db
 
 =head2 $c->debug
 
@@ -592,14 +591,14 @@ sub setup {
 
     $class->setup_home( delete $flags->{home} );
 
-    # JSON config support
+    # YAML config support
     my $confpath = $class->config->{file}
       || $class->path_to(
-        ( Catalyst::Utils::appprefix( ref $class || $class ) . '.json' ) );
+        ( Catalyst::Utils::appprefix( ref $class || $class ) . '.yml' ) );
     my $conf = {};
     if ( -f $confpath ) {
         my $content = read_file("$confpath");
-        $conf = jsonToObj($content);
+        $conf = YAML::Syck::Load($content);
     }
     my $oldconf = $class->config;
     $class->config( { %$oldconf, %$conf } );
index ff54067..d965711 100644 (file)
@@ -360,7 +360,7 @@ sub _mk_config {
     my $dir       = $self->{dir};
     my $appprefix = $self->{appprefix};
     $self->render_file( 'config',
-        File::Spec->catfile( $dir, "$appprefix.json" ) );
+        File::Spec->catfile( $dir, "$appprefix.yml" ) );
 }
 
 sub _mk_readme {
@@ -616,9 +616,8 @@ install_script glob('script/*.pl');
 auto_install;
 WriteAll;
 __config__
-{
-    "name" : "[% name %]"
-}
+---
+name: [% name %]
 __readme__
 Run script/[% appprefix %]_server.pl to test the application.
 __changes__
@@ -784,7 +783,7 @@ my $port          = 3000;
 my $keepalive     = 0;
 my $restart       = 0;
 my $restart_delay = 1;
-my $restart_regex = '\.yml$|\.yaml$|\.json|\.pm$';
+my $restart_regex = '\.yml$|\.yaml$|\.pm$';
 
 my @argv = @ARGV;
 
@@ -845,7 +844,7 @@ require [% name %];
    -rd -restartdelay  delay between file checks
    -rr -restartregex  regex match files that trigger
                       a restart when modified
-                      (defaults to '\.yml$|\.yaml$|\.json|\.pm$')
+                      (defaults to '\.yml$|\.yaml$|\.pm$')
 
  See also:
    perldoc Catalyst::Manual