# This file documents the revision history for Perl extension Catalyst.
5.7013
+ - Fix subdirs for scripts that run in subdirs more than one level deep.
- Added test and updated docs for handling the Authorization header
under mod_fastcgi/mod_cgi.
- Fixed bug in HTTP engine where the connection was not closed properly if the
# clean up relative path:
# MyApp/script/.. -> MyApp
- my ($lastdir) = $home->dir_list( -1, 1 );
- if ( $lastdir eq '..' ) {
+ my $dir;
+ my @dir_list = $home->dir_list();
+ while (($dir = pop(@dir_list)) && $dir eq '..') {
$home = dir($home)->parent->parent;
}
--- /dev/null
+use Test::More tests=>7;
+
+use strict;
+use warnings;
+
+# simulates an entire testapp rooted at t/something
+# except without bothering creating it since its
+# only the -e check on the Makefile.PL that matters
+
+BEGIN { use_ok 'Catalyst::Utils' }
+use FindBin;
+
+$INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
+my $home = Catalyst::Utils::home('TestApp');
+like($home, qr/t\/something/, "has path TestApp/t/something");
+unlike($home, qr/\/script\/foo/, "doesn't have path /script/foo");
+
+$INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/bar/../../../lib/TestApp.pm";
+$home = Catalyst::Utils::home('TestApp');
+like($home, qr/t\/something/, "has path TestApp/t/something");
+unlike($home, qr/\/script\/foo\/bar/, "doesn't have path /script/foo");
+
+$INC{'TestApp.pm'} = "$FindBin::Bin/something/script/../lib/TestApp.pm";
+$home = Catalyst::Utils::home('TestApp');
+like($home, qr/t\/something/, "has path TestApp/t/something");
+unlike($home, qr/\/script\/foo/, "doesn't have path /script/foo");