1 #line 1 "inc/Module/Install/Can.pm - /Library/Perl/5.8.6/Module/Install/Can.pm"
2 package Module::Install::Can;
4 use Module::Install::Base;
5 @ISA = qw(Module::Install::Base);
11 use ExtUtils::MakeMaker ();
13 # This may introduce a 5.005 dependency, or at the very least it may
14 # not bootstrap properly under 5.004.
17 # check if we can load some module
19 my ($self, $mod, $ver) = @_;
21 $mod .= ".pm" unless $mod =~ /\.pm$/i;
28 eval { require $mod; $pkg->VERSION($ver || 0); 1 };
31 # check if we can run some command
33 my ($self, $cmd) = @_;
36 return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
38 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
39 my $abs = File::Spec->catfile($dir, $_[1]);
40 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
48 my @chunks = split(/ /, $Config::Config{cc}) or return;
50 # $Config{cc} may contain args; try to find out the program part
52 return $self->can_run("@chunks") || (pop(@chunks), next);
58 # Fix Cygwin bug on maybe_command();
59 if ($^O eq 'cygwin') {
60 require ExtUtils::MM_Cygwin;
61 require ExtUtils::MM_Win32;
62 if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
63 *ExtUtils::MM_Cygwin::maybe_command = sub {
64 my ($self, $file) = @_;
65 if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
66 ExtUtils::MM_Win32->maybe_command($file);
69 ExtUtils::MM_Unix->maybe_command($file);