From: Sebastian Riedel Date: Wed, 25 Jan 2006 10:39:09 +0000 (+0000) Subject: Switched from JSON to YAML::Syck X-Git-Tag: 5.7099_04~727 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=c0f74851f0f37dd24be65f03ad29f71fb642db99 Switched from JSON to YAML::Syck --- diff --git a/Changes b/Changes index 5af7395..2f33db4 100644 --- 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 diff --git a/Makefile.PL b/Makefile.PL index 83d51a1..3b246d5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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', diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 00e62fa..5a91f46 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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 config file like myapp.json in your +You can also use a L 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 } ); diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index ff54067..d965711 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -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