| 26 | | my $dirs = List::Util::first { |
| 27 | | -f File::Spec->catpath( $v, $_, 'Makefile.PL' ) |
| 28 | | or -f File::Spec->catpath( $v, $_, 'Build.PL' ) |
| 29 | | or -f File::Spec->catpath( $v, $_, 'dist.ini' ) |
| 30 | | or -f File::Spec->catpath( $v, $_, 'padre.yml' ); |
| 31 | | } |
| 32 | | map { File::Spec->catdir( @d[ 0 .. $_ ] ) } reverse( 0 .. $#d ); |
| 33 | | unless ( defined $dirs ) { |
| | 28 | foreach ( reverse 0 .. $#d ) { |
| | 29 | my $dir = File::Spec->catdir( @d[ 0 .. $_ ] ); |
| | 30 | |
| | 31 | # Check for Dist::Zilla support |
| | 32 | my $dist_ini = File::Spec->catpath( $v, $dir, 'dist.ini' ); |
| | 33 | if ( -f $dist_ini ) { |
| | 34 | return Padre::Project::Perl::DZ->new( |
| | 35 | root => File::Spec->catpath( $v, $dir ), |
| | 36 | dist_ini => $dist_ini, |
| | 37 | ); |
| | 38 | } |
| | 39 | |
| | 40 | # Check for Module::Build support |
| | 41 | my $build_pl = File::Spec->catpath( $v, $dir, 'Build.PL' ); |
| | 42 | if ( -f $build_pl ) { |
| | 43 | return Padre::Project::Perl::MB->new( |
| | 44 | root => File::Spec->catpath( $v, $dir ), |
| | 45 | build_pl => $build_pl, |
| | 46 | ); |
| | 47 | } |
| | 48 | |
| | 49 | # Check for ExtUtils::MakeMaker and Module::Install support |
| | 50 | my $makefile_pl = File::Spec->catpath( $v, $dir, 'Makefile.PL' ); |
| | 51 | if ( -f $makefile_pl ) { |
| | 52 | # Differentiate between Module::Install and ExtUtils::MakeMaker |
| | 53 | return Padre::Project::Perl::EUMM->new( |
| | 54 | root => File::Spec->catpath( $v, $dir ), |
| | 55 | makefile_pl => $makefile_pl, |
| | 56 | ); |
| | 57 | } |
| | 58 | |
| | 59 | # Fall back to looking for null projects |
| | 60 | my $padre_yml = File::Spec->catpath( $v, $dir, 'padre.yml' ); |
| | 61 | if ( -f $padre_yml ) { |
| | 62 | return Padre::Project::Perl->new( |
| | 63 | root => File::Spec->catpath( $v, $dir ), |
| | 64 | padre_yml => $padre_yml, |
| | 65 | ); |
| | 66 | } |
| | 67 | |