fix configloader to use Catalyst::Utils::env_value()
Brian Cassidy [Wed, 22 Aug 2007 02:28:08 +0000 (02:28 +0000)]
Changes
lib/Catalyst/Plugin/ConfigLoader.pm

diff --git a/Changes b/Changes
index 429ad86..d798593 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 Revision history for Perl extension Catalyst::Plugin::ConfigLoader.
 
+0.16  Wed Aug 22 2007
+    [THINGS THAT MAY BREAK YOUR CODE]
+    - use Catalyst::Utils::env_value() to get $ENV values. This means that
+      MYAPP_* is of higher precedence than CATALYST_* -- this differs from
+      the behavior of older releases.
+
 0.15  Tue Aug 21 2007
     - Allow multiple __HOME__ and __path_to()__ replaces in one string
       (Greg Sheard)
index a12539e..8763331 100644 (file)
@@ -6,8 +6,9 @@ use warnings;
 use Config::Any;
 use NEXT;
 use Data::Visitor::Callback;
+use Catalyst::Utils ();
 
-our $VERSION = '0.15';
+our $VERSION = '0.16';
 
 =head1 NAME
 
@@ -130,6 +131,8 @@ The order of preference is specified as:
 
 =item * C<$ENV{ MYAPP_CONFIG }>
 
+=item * C<$ENV{ CATALYST_CONFIG }>
+
 =item * C<$c-E<gt>config-E<gt>{ file }>
 
 =item * C<$c-E<gt>path_to( $application_prefix )>
@@ -145,7 +148,7 @@ sub get_config_path {
     my $c       = shift;
     my $appname = ref $c || $c;
     my $prefix  = Catalyst::Utils::appprefix( $appname );
-    my $path    = $ENV{ Catalyst::Utils::class2env( $appname ) . '_CONFIG' }
+    my $path    = Catalyst::Utils::env_value( $c, 'CONFIG' )
         || $c->config->{ file }
         || $c->path_to( $prefix );
 
@@ -166,10 +169,10 @@ this value is C<local>, but it can be specified in the following order of prefer
 
 =over 4
 
-=item * C<$ENV{ CATALYST_CONFIG_LOCAL_SUFFIX }>
-
 =item * C<$ENV{ MYAPP_CONFIG_LOCAL_SUFFIX }>
 
+=item * C<$ENV{ CATALYST_CONFIG_LOCAL_SUFFIX }>
+
 =item * C<$c-E<gt>config-E<gt>{ config_local_suffix }>
 
 =back
@@ -179,8 +182,7 @@ this value is C<local>, but it can be specified in the following order of prefer
 sub get_config_local_suffix {
     my $c       = shift;
     my $appname = ref $c || $c;
-    my $suffix  = $ENV{ CATALYST_CONFIG_LOCAL_SUFFIX }
-        || $ENV{ Catalyst::Utils::class2env( $appname ) . '_CONFIG_LOCAL_SUFFIX' }
+    my $suffix  = Catalyst::Utils::env_value( $c, 'CONFIG_LOCAL_SUFFIX' )
         || $c->config->{ config_local_suffix }
         || 'local';