$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;
+ }
}
{
sub ensure_class_loaded {
my $class = shift;
+ my $opts = shift;
- return if Class::Inspector->loaded( $class ); # if a symbol entry exists we don't load again
+ return if !$opts->{ ignore_loaded }
+ && Class::Inspector->loaded( $class ); # if a symbol entry exists we don't load again
# this hack is so we don't overwrite $@ if the load did not generate an error
my $error;