1 #line 1 "inc/Module/Install/Can.pm - /Users/ingy/local/lib/perl5/site_perl/5.8.6/Module/Install/Can.pm"
2 package Module::Install::Can;
3 use Module::Install::Base; @ISA = qw(Module::Install::Base);
9 use ExtUtils::MakeMaker ();
11 # check if we can load some module
13 my ($self, $mod, $ver) = @_;
15 $mod .= ".pm" unless $mod =~ /\.pm$/i;
22 eval { require $mod; $pkg->VERSION($ver || 0); 1 };
25 # check if we can run some command
27 my ($self, $cmd) = @_;
30 return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
32 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
33 my $abs = File::Spec->catfile($dir, $_[1]);
34 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
42 my @chunks = split(/ /, $Config::Config{cc}) or return;
44 # $Config{cc} may contain args; try to find out the program part
46 return $self->can_run("@chunks") || (pop(@chunks), next);
52 # Fix Cygwin bug on maybe_command();
53 if ($^O eq 'cygwin') {
54 require ExtUtils::MM_Cygwin;
55 require ExtUtils::MM_Win32;
56 if (!defined(&ExtUtils::MM_Cygwin::maybe_command)) {
57 *ExtUtils::MM_Cygwin::maybe_command = sub {
58 my ($self, $file) = @_;
59 if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
60 ExtUtils::MM_Win32->maybe_command($file);
63 ExtUtils::MM_Unix->maybe_command($file);