File-ProjectHome

 view release on metacpan or  search on metacpan

lib/File/ProjectHome.pm  view on Meta::CPAN


our @PROJECT_ROOT_FILES = qw(
    cpanfile
    .git
    .gitmodules
    Makefile.PL
    Build.PL
);

sub project_home {
    my $dir = dir((caller)[1]);
    while (my $parent = _parent($dir)) {
        for my $project_root_files (@PROJECT_ROOT_FILES) {
            if (-e File::Spec->catfile($dir, $project_root_files)) {
                return "$dir";
            }
        }
        $dir = $parent;
    }
}



( run in 1.071 second using v1.01-cache-2.11-cpan-1e74a51a04c )