From: Tomas Doran Date: Thu, 19 Aug 2010 23:01:53 +0000 (+0000) Subject: Fix issue from the mailing list X-Git-Tag: v0.29~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5bdb6290f42eb75d022c59f2f2f573163bbb4bd5;hp=c509433895a7c9d0253b7214521863f55ae2680f;p=catagits%2FCatalyst-Plugin-ConfigLoader.git Fix issue from the mailing list --- diff --git a/Changes b/Changes index 4ef4f82..f482361 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension Catalyst::Plugin::ConfigLoader. + - Fix issue with 2 character app names that are kept in versioned + directories (e.g. app called QX in QX-2.1.5/) - bump dep on Config::Any to use the -ForceArray Config::General option (caelum) diff --git a/lib/Catalyst/Plugin/ConfigLoader.pm b/lib/Catalyst/Plugin/ConfigLoader.pm index 9e8e574..e137120 100644 --- a/lib/Catalyst/Plugin/ConfigLoader.pm +++ b/lib/Catalyst/Plugin/ConfigLoader.pm @@ -183,7 +183,7 @@ sub get_config_path { || $c->config->{ 'Plugin::ConfigLoader' }->{ file } || $c->path_to( $prefix ); - my ( $extension ) = ( $path =~ m{\.(.{1,4})$} ); + my ( $extension ) = ( $path =~ m{\.([^/\.]{1,4})$} ); if ( -d $path ) { $path =~ s{[\/\\]$}{}; diff --git a/t/24-mock-shortappname.t b/t/24-mock-shortappname.t new file mode 100644 index 0000000..87fa57a --- /dev/null +++ b/t/24-mock-shortappname.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +use Test::More; + +{ + package QX; + use strict; + use warnings; + use Path::Class (); + + use base 'Catalyst::Plugin::ConfigLoader'; + + sub config { {} } + sub path_to { shift; Path::Class::dir('/home/foo/QX-0.9.5/' . shift); } +} + +my $app = bless {}, 'QX'; +my ($path, $extension) = $app->get_config_path; +is $path, '/home/foo/QX-0.9.5/qx'; +is $extension, undef; + +done_testing; +