Changeset 11385 for lang/perl/Catalyst-Plugin-ConfigLoader-Multi/trunk
- Timestamp:
- 05/11/08 11:28:08 (5 years ago)
- Location:
- lang/perl/Catalyst-Plugin-ConfigLoader-Multi/trunk
- Files:
-
- 3 modified
-
Changes (modified) (1 diff)
-
lib/Catalyst/Plugin/ConfigLoader/Multi.pm (modified) (3 diffs)
-
t/spelling.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Catalyst-Plugin-ConfigLoader-Multi/trunk/Changes
r9013 r11385 1 1 Revision history for Catalyst-Plugin-ConfigLoader-Multi 2 3 0.06 2008-05-17/11:21 4 - loal only myapp_local.yaml insetad of myapp*_local.yaml. because the specific may generate bug for your application when you set same key in your each local files. 5 - fix POD 2 6 3 7 0.05 2008-04-06/20:24 -
lang/perl/Catalyst-Plugin-ConfigLoader-Multi/trunk/lib/Catalyst/Plugin/ConfigLoader/Multi.pm
r9013 r11385 9 9 use NEXT; 10 10 11 our $VERSION = 0.05; 11 our $VERSION = 0.06; 12 12 13 13 14 sub find_files { 14 15 my $c = shift; 16 my ( $path, $extension ) = $c->get_config_path; 17 my $suffix = $c->get_config_local_suffix; 18 my @extensions = @{ Config::Any->extensions }; 15 19 16 my @files = $c->SUPER::find_files(); 20 my $prefix = Catalyst::Utils::appprefix( ref $c || $c ); 21 my $config_key_name = uc($prefix) . '_CONFIG_MULTI'; 22 23 my @files; 24 if ( $extension ) { 25 die "Unable to handle files with the extension '${extension}'" 26 unless grep { $_ eq $extension } @extensions; 27 ( my $local = $path ) =~ s{\.$extension}{_$suffix.$extension}; 28 push @files, $path, $local; 29 } 30 else { 31 # do not append lcoal suffix 32 if ($ENV{ $config_key_name } ) { 33 @files = map { ( "$path.$_" ) } @extensions; 34 } 35 else { 36 @files = map { ( "$path.$_", "${path}_${suffix}.$_" ) } @extensions; 37 } 38 } 17 39 my @my_files = $c->_find_my_files(); 18 40 19 return ( @files, @my_files ); 41 push @my_files , $ENV{$config_key_name} if $ENV{$config_key_name} ; 42 43 return @my_files, @files; 20 44 } 21 45 … … 35 59 my $dh = DirHandle->new($path); 36 60 37 my $config_key_name = uc($prefix) . '_CONFIG_MULTI';38 39 61 40 62 while ( my $file = $dh->read() ) { 41 63 next unless $file =~ /^$prefix\_(.+)\.\w+$/ && $suffix ne $1; 42 64 43 44 if ( $ENV{ $config_key_name } ) { 45 push @my_files, ( 46 map { 47 ( "${path_prefix}_${1}.$_",) 48 } @extensions 49 ); 50 } 51 else { 52 push @my_files, ( 53 map { 54 ( "${path_prefix}_${1}.$_", 55 "${path_prefix}_${1}_${suffix}.$_" 56 ) 57 } @extensions 58 ); 59 } 65 push @my_files, ( map { ( "${path_prefix}_${1}.$_", ) } @extensions ); 60 66 } 61 67 62 push @my_files , $ENV{ $config_key_name } if $ENV{ $config_key_name };63 68 64 69 return @my_files; … … 134 139 =head1 ENV 135 140 136 you can specify local file with this setting. 141 you can specify local file with this setting.( you must use local_sufix for the file name ) 137 142 138 143 $ENV{MYAPP_CONFIG_MULTI} = '/tmp/foo/your_own_local.yaml' -
lang/perl/Catalyst-Plugin-ConfigLoader-Multi/trunk/t/spelling.t
r9160 r11385 2 2 use Test::Spelling; 3 3 $ENV{LANG} = 'C'; 4 5 $ENV{TEST_SPELLING} or plan skip_all => "no test for spelling. you must set TEST_SPELLING env for activate this test"; 4 6 5 7 my $spell_cmd;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)