[Catalyst-commits] r7146 - in trunk/Catalyst-Plugin-ConfigLoader: . lib/Catalyst/Plugin lib/Catalyst/Plugin/ConfigLoader t t/lib t/lib/TestApp t/lib/TestApp/Controller t/mockapp

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Wed Nov 21 13:15:02 GMT 2007


Author: bricas
Date: 2007-11-21 13:15:02 +0000 (Wed, 21 Nov 2007)
New Revision: 7146

Modified:
   trunk/Catalyst-Plugin-ConfigLoader/Makefile.PL
   trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
   trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod
   trunk/Catalyst-Plugin-ConfigLoader/t/01-use.t
   trunk/Catalyst-Plugin-ConfigLoader/t/10-live_auto.t
   trunk/Catalyst-Plugin-ConfigLoader/t/20-mock_load.t
   trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t
   trunk/Catalyst-Plugin-ConfigLoader/t/98-pod_coverage.t
   trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp.pm
   trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/Controller/Config.pm
   trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/testapp.pl
   trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp.pl
   trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp_local.pl
Log:
perltidy

Modified: trunk/Catalyst-Plugin-ConfigLoader/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/Makefile.PL	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/Makefile.PL	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,6 +1,6 @@
 use inc::Module::Install 0.67;
 
-if( -e 'MANIFEST.SKIP' ) {
+if ( -e 'MANIFEST.SKIP' ) {
     system( 'pod2text lib/Catalyst/Plugin/ConfigLoader.pm > README' );
 }
 
@@ -9,7 +9,7 @@
 name 'Catalyst-Plugin-ConfigLoader';
 all_from 'lib/Catalyst/Plugin/ConfigLoader.pm';
 
-requires 'Catalyst::Runtime' => '5.7008'; # needed for env_value()
+requires 'Catalyst::Runtime' => '5.7008';    # needed for env_value()
 requires 'Data::Visitor'     => '0.02';
 requires 'Config::Any'       => '0.08';
 

Modified: trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,3 +1,4 @@
+
 =head1 NAME 
 
 Catalyst::Plugin::ConfigLoader::Manual - Guide to using the ConfigLoader plugin

Modified: trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm	2007-11-21 13:15:02 UTC (rev 7146)
@@ -50,24 +50,27 @@
 sub setup {
     my $c     = shift;
     my @files = $c->find_files;
-    my $cfg   = Config::Any->load_files( {
-        files       => \@files, 
-        filter      => \&_fix_syntax,
-        use_ext     => 1,
-        driver_args => $c->config->{'Plugin::ConfigLoader'}->{driver} || {},
-    } );
+    my $cfg   = Config::Any->load_files(
+        {   files       => \@files,
+            filter      => \&_fix_syntax,
+            use_ext     => 1,
+            driver_args => $c->config->{ 'Plugin::ConfigLoader' }->{ driver }
+                || {},
+        }
+    );
 
     # split the responses into normal and local cfg
     my $local_suffix = $c->get_config_local_suffix;
-    my( @cfg, @localcfg );
-    for( @$cfg ) {
-        if( ( keys %$_ )[ 0 ] =~ m{ $local_suffix \. }xms ) {
+    my ( @cfg, @localcfg );
+    for ( @$cfg ) {
+        if ( ( keys %$_ )[ 0 ] =~ m{ $local_suffix \. }xms ) {
             push @localcfg, $_;
-        } else {
+        }
+        else {
             push @cfg, $_;
         }
     }
-    
+
     # load all the normal cfgs, then the local cfgs last so they can override
     # normal cfgs
     $c->load_config( $_ ) for @cfg, @localcfg;
@@ -86,9 +89,9 @@
 sub load_config {
     my $c   = shift;
     my $ref = shift;
-    
-    my( $file, $config ) = each %$ref;
-    
+
+    my ( $file, $config ) = each %$ref;
+
     $c->config( $config );
     $c->log->debug( qq(Loaded Config "$file") )
         if $c->debug;
@@ -106,16 +109,17 @@
 
 sub find_files {
     my $c = shift;
-    my( $path, $extension ) = $c->get_config_path;
+    my ( $path, $extension ) = $c->get_config_path;
     my $suffix     = $c->get_config_local_suffix;
     my @extensions = @{ Config::Any->extensions };
-    
+
     my @files;
-    if ($extension) {
+    if ( $extension ) {
         next unless grep { $_ eq $extension } @extensions;
         ( my $local = $path ) =~ s{\.$extension}{_$suffix.$extension};
         push @files, $path, $local;
-    } else {
+    }
+    else {
         @files = map { ( "$path.$_", "${path}_${suffix}.$_" ) } @extensions;
     }
 
@@ -151,28 +155,30 @@
 =cut
 
 sub get_config_path {
-    my $c       = shift;
+    my $c = shift;
 
     # deprecation notice
-    if( exists $c->config->{ file } ) {
-        $c->log->warn( q("file" config parameter has been deprecated in favor of "$c->config->{ 'Plugin::ConfigLoader' }->{ file }") );
+    if ( exists $c->config->{ file } ) {
+        $c->log->warn(
+            q("file" config parameter has been deprecated in favor of "$c->config->{ 'Plugin::ConfigLoader' }->{ file }")
+        );
     }
 
     my $appname = ref $c || $c;
     my $prefix  = Catalyst::Utils::appprefix( $appname );
     my $path    = Catalyst::Utils::env_value( $c, 'CONFIG' )
         || $c->config->{ 'Plugin::ConfigLoader' }->{ file }
-        || $c->config->{ file } # to be removed next release
+        || $c->config->{ file }    # to be removed next release
         || $c->path_to( $prefix );
 
-    my( $extension ) = ( $path =~ m{\.(.{1,4})$} );
-    
-    if( -d $path ) {
-        $path  =~ s{[\/\\]$}{};
+    my ( $extension ) = ( $path =~ m{\.(.{1,4})$} );
+
+    if ( -d $path ) {
+        $path =~ s{[\/\\]$}{};
         $path .= "/$prefix";
     }
 
-    return( $path, $extension );
+    return ( $path, $extension );
 }
 
 =head2 get_config_local_suffix
@@ -196,17 +202,20 @@
 =cut
 
 sub get_config_local_suffix {
-    my $c       = shift;
+    my $c = shift;
 
     # deprecation notice
-    if( exists $c->config->{ config_local_suffix } ) {
-        $c->log->warn( q("config_local_suffix" config parameter has been deprecated in favor of "$c->config->{ 'Plugin::ConfigLoader' }->{ config_local_suffix }") );
+    if ( exists $c->config->{ config_local_suffix } ) {
+        $c->log->warn(
+            q("config_local_suffix" config parameter has been deprecated in favor of "$c->config->{ 'Plugin::ConfigLoader' }->{ config_local_suffix }")
+        );
     }
 
     my $appname = ref $c || $c;
-    my $suffix  = Catalyst::Utils::env_value( $c, 'CONFIG_LOCAL_SUFFIX' )
+    my $suffix = Catalyst::Utils::env_value( $c, 'CONFIG_LOCAL_SUFFIX' )
         || $c->config->{ 'Plugin::ConfigLoader' }->{ config_local_suffix }
-        || $c->config->{ config_local_suffix } # to be remove in the next release
+        || $c->config
+        ->{ config_local_suffix }    # to be remove in the next release
         || 'local';
 
     return $suffix;
@@ -219,10 +228,8 @@
             prefix => $_ eq 'Component' ? '' : $_ . '::',
             values => delete $config->{ lc $_ } || delete $config->{ $_ }
         },
-        grep {
-            ref $config->{ lc $_ } || ref $config->{ $_ }
-        }
-        qw( Component Model M View V Controller C )
+        grep { ref $config->{ lc $_ } || ref $config->{ $_ } }
+            qw( Component Model M View V Controller C )
     );
 
     foreach my $comp ( @components ) {
@@ -286,9 +293,10 @@
 =cut
 
 sub config_substitutions {
-    my $c = shift;
-    my $subs = $c->config->{ 'Plugin::ConfigLoader' }->{ substitutions } || {};
-    $subs->{ HOME } ||= sub { shift->path_to( '' ); };
+    my $c    = shift;
+    my $subs = $c->config->{ 'Plugin::ConfigLoader' }->{ substitutions }
+        || {};
+    $subs->{ HOME }    ||= sub { shift->path_to( '' ); };
     $subs->{ path_to } ||= sub { shift->path_to( @_ ); };
     $subs->{ literal } ||= sub { return $_[ 1 ]; };
     my $subsre = join( '|', keys %$subs );
@@ -298,7 +306,6 @@
     }
 }
 
-
 =head1 AUTHOR
 
 Brian Cassidy E<lt>bricas at cpan.orgE<gt>

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/01-use.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/01-use.t	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/01-use.t	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,5 +1,5 @@
 use Test::More tests => 1;
 
-BEGIN { 
+BEGIN {
     use_ok( 'Catalyst::Plugin::ConfigLoader' );
 }

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/10-live_auto.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/10-live_auto.t	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/10-live_auto.t	2007-11-21 13:15:02 UTC (rev 7146)
@@ -10,17 +10,21 @@
 
 {
     my $response;
-    ok( $response = request('http://localhost/config/'), 'request ok' );
+    ok( $response = request( 'http://localhost/config/' ), 'request ok' );
     is( $response->content, 'foo', 'config ok' );
 
-    $response = request('http://localhost/appconfig/cache');
-    ok( $response->content !~ /^__HOME__/, 'home dir substituted in config var' );
+    $response = request( 'http://localhost/appconfig/cache' );
+    ok( $response->content !~ /^__HOME__/,
+        'home dir substituted in config var'
+    );
 
-    $response = request('http://localhost/appconfig/foo');
+    $response = request( 'http://localhost/appconfig/foo' );
     is( $response->content, 'bar', 'app finalize_config works' );
 
-    $response = request('http://localhost/appconfig/multi');
+    $response = request( 'http://localhost/appconfig/multi' );
     my $home = TestApp->config->{ home };
-    my $path = join( ',', $home, TestApp->path_to( 'x' ), $home, TestApp->path_to( 'y' ) );
+    my $path = join( ',',
+        $home, TestApp->path_to( 'x' ),
+        $home, TestApp->path_to( 'y' ) );
     is( $response->content, $path, 'vars substituted in config var, twice' );
 }

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/20-mock_load.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/20-mock_load.t	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/20-mock_load.t	2007-11-21 13:15:02 UTC (rev 7146)
@@ -8,7 +8,7 @@
 use_ok( 'Catalyst', qw( ConfigLoader ) );
 
 __PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
-    foo => sub { shift; join('-', @_); }
+    foo => sub { shift; join( '-', @_ ); }
 };
 
 __PACKAGE__->setup;
@@ -16,8 +16,8 @@
 ok( __PACKAGE__->config );
 is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
 is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
-is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
-is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
-is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
-is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
-is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux },      'xyzzy' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ another },  'new key' );
+is( __PACKAGE__->config->{ 'view' },                     'View::TT::New' );
+is( __PACKAGE__->config->{ 'foo_sub' },                  'x-y' );
+is( __PACKAGE__->config->{ 'literal_macro' },            '__DATA__' );

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t	2007-11-21 13:15:02 UTC (rev 7146)
@@ -3,13 +3,13 @@
 use Test::More tests => 9;
 
 use Cwd;
-$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';
+$ENV{ CATALYST_HOME }  = cwd . '/t/mockapp';
 $ENV{ MOCKAPP_CONFIG } = $ENV{ CATALYST_HOME } . '/mockapp.pl';
 
 use_ok( 'Catalyst', qw( ConfigLoader ) );
 
 __PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
-    foo => sub { shift; join('-', @_); }
+    foo => sub { shift; join( '-', @_ ); }
 };
 
 __PACKAGE__->setup;
@@ -17,8 +17,8 @@
 ok( __PACKAGE__->config );
 is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
 is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
-is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
-is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
-is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
-is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
-is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux },      'xyzzy' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ another },  'new key' );
+is( __PACKAGE__->config->{ 'view' },                     'View::TT::New' );
+is( __PACKAGE__->config->{ 'foo_sub' },                  'x-y' );
+is( __PACKAGE__->config->{ 'literal_macro' },            '__DATA__' );

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/98-pod_coverage.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/98-pod_coverage.t	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/98-pod_coverage.t	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,4 +1,5 @@
 use Test::More;
 eval "use Test::Pod::Coverage 1.00";
-plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage"
+    if $@;
 all_pod_coverage_ok();

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/Controller/Config.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/Controller/Config.pm	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/Controller/Config.pm	2007-11-21 13:15:02 UTC (rev 7146)
@@ -6,7 +6,7 @@
 use base qw( Catalyst::Controller );
 
 sub index : Private {
-    my( $self, $c ) = @_;
+    my ( $self, $c ) = @_;
     $c->res->output( $self->{ foo } );
 }
 

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/testapp.pl
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/testapp.pl	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp/testapp.pl	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,8 +1,5 @@
-{
-    name               => 'TestApp',
-    Controller::Config => {
-        foo => 'foo'
-    },
+{   name               => 'TestApp',
+    Controller::Config => { foo => 'foo' },
     cache              => '__HOME__/cache',
     multi              => '__HOME__,__path_to(x)__,__HOME__,__path_to(y)__',
 }

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp.pm	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/lib/TestApp.pm	2007-11-21 13:15:02 UTC (rev 7146)
@@ -11,13 +11,13 @@
 
 sub finalize_config {
     my $c = shift;
-    $c->config(foo => 'bar');
+    $c->config( foo => 'bar' );
     $c->NEXT::finalize_config;
 }
 
 sub appconfig : Local {
-    my ($self,$c,$var) = @_;
-    $c->res->body($c->config->{$var});
+    my ( $self, $c, $var ) = @_;
+    $c->res->body( $c->config->{ $var } );
 }
 
 1;

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp.pl
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp.pl	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp.pl	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,12 +1,7 @@
-{
-    name => 'TestApp',
-    view => 'View::TT',
-    'Controller::Foo' => {
-        foo => 'bar'
-    },
-    'Model::Baz' => {
-        qux => 'xyzzy'
-    },
-    foo_sub => '__foo(x,y)__',
-    literal_macro => '__literal(__DATA__)__',
+{   name              => 'TestApp',
+    view              => 'View::TT',
+    'Controller::Foo' => { foo => 'bar' },
+    'Model::Baz'      => { qux => 'xyzzy' },
+    foo_sub           => '__foo(x,y)__',
+    literal_macro     => '__literal(__DATA__)__',
 }

Modified: trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp_local.pl
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp_local.pl	2007-11-21 13:13:04 UTC (rev 7145)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/mockapp/mockapp_local.pl	2007-11-21 13:15:02 UTC (rev 7146)
@@ -1,11 +1,4 @@
-{
-    view => 'View::TT::New',
-    'Controller::Foo' => {
-        new => 'key'
-    },
-    Component => {
-        'Model::Baz' => {
-            'another' => 'new key'
-        }
-    }
+{   view              => 'View::TT::New',
+    'Controller::Foo' => { new => 'key' },
+    Component         => { 'Model::Baz' => { 'another' => 'new key' } }
 }




More information about the Catalyst-commits mailing list