Skip to content

Commit

Permalink
Get rid of Capture::Tiny
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Jul 12, 2012
1 parent 6284a09 commit 1257751
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,6 +1,7 @@
Revision history for Devel-FindPerl Revision history for Devel-FindPerl


{{$NEXT}} {{$NEXT}}
Get rid of Capture::Tiny dependency


0.001 2012-06-20 20:37:18 Europe/Amsterdam 0.001 2012-06-20 20:37:18 Europe/Amsterdam
- Initial release
16 changes: 8 additions & 8 deletions lib/Devel/FindPerl.pm
Expand Up @@ -5,7 +5,6 @@ use warnings;
use Exporter 5.57 'import'; use Exporter 5.57 'import';
our @EXPORT_OK = qw/find_perl_interpreter/; our @EXPORT_OK = qw/find_perl_interpreter/;


use Capture::Tiny 'capture';
use Carp; use Carp;
use Cwd; use Cwd;
use ExtUtils::Config; use ExtUtils::Config;
Expand Down Expand Up @@ -73,7 +72,7 @@ sub _perl_src {


return unless $ENV{PERL_CORE}; return unless $ENV{PERL_CORE};


my $Updir = File::Spec->updir; my $updir = File::Spec->updir;
my $dir = File::Spec->curdir; my $dir = File::Spec->curdir;


# Try up to 10 levels upwards # Try up to 10 levels upwards
Expand All @@ -88,7 +87,7 @@ sub _perl_src {
return Cwd::realpath( $dir ); return Cwd::realpath( $dir );
} }


$dir = File::Spec->catdir($dir, $Updir); $dir = File::Spec->catdir($dir, $updir);
} }


carp "PERL_CORE is set but I can't find your perl source!\n"; carp "PERL_CORE is set but I can't find your perl source!\n";
Expand All @@ -98,20 +97,21 @@ sub _perl_src {
sub _perl_is_same { sub _perl_is_same {
my $perl = shift; my $perl = shift;


my @cmd = ($perl); my @cmd = $perl;


# When run from the perl core, @INC will include the directories # When run from the perl core, @INC will include the directories
# where perl is yet to be installed. We need to reference the # where perl is yet to be installed. We need to reference the
# absolute path within the source distribution where it can find # absolute path within the source distribution where it can find
# it's Config.pm This also prevents us from picking up a Config.pm # it's Config.pm This also prevents us from picking up a Config.pm
# from a different configuration that happens to be already # from a different configuration that happens to be already
# installed in @INC. # installed in @INC.
if ($ENV{PERL_CORE}) { push @cmd, '-I' . File::Spec->catdir(File::Basename::dirname($perl), 'lib') if $ENV{PERL_CORE};
push @cmd, '-I' . File::Spec->catdir(File::Basename::dirname($perl), 'lib');
}


push @cmd, qw(-MConfig=myconfig -e print -e myconfig); push @cmd, qw(-MConfig=myconfig -e print -e myconfig);
return capture { system @cmd } eq Config->myconfig; open my $fh, '-|', @cmd or return;
my $myconfig = join '', <$fh>;
close $fh or return;
return $myconfig eq Config->myconfig;
} }


1; 1;
Expand Down

0 comments on commit 1257751

Please sign in to comment.