From: Matt S Trout Date: Wed, 28 Jun 2006 17:07:16 +0000 (+0000) Subject: fixup to Catalyst::Utils::home X-Git-Tag: 5.7099_04~453 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=c09c6cd743a02ecebd5ad1277475baec2a8df400 fixup to Catalyst::Utils::home --- diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index dae3439..59b8ca0 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -165,8 +165,18 @@ sub home { $home = $home->parent while $home =~ /b?lib$/; # only return the dir if it has a Makefile.PL or Build.PL - return $home->stringify - if $home->file("Makefile.PL") or -f $home->file("Build.PL"); + if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")) { + + # clean up relative path: + # MyApp/script/.. -> MyApp + + my ($lastdir) = $home->dir_list( -1, 1 ); + if ( $lastdir eq '..' ) { + $home = dir($home)->parent->parent; + } + + return $home->stringify; + } } {