~ubuntu-branches/ubuntu/trusty/libmodule-signature-perl/trusty-updates

« back to all changes in this revision

Viewing changes to inc/Module/Install/Can.pm

  • Committer: Bazaar Package Importer
  • Author(s): Chip Salzenberg
  • Date: 2003-10-05 21:45:16 UTC
  • Revision ID: james.westby@ubuntu.com-20031005214516-93q02srkdovy5lor
Tags: upstream-0.35
ImportĀ upstreamĀ versionĀ 0.35

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#line 1 "inc/Module/Install/Can.pm - /usr/local/lib/perl5/site_perl/5.8.0/Module/Install/Can.pm"
 
2
# $File: //depot/cpan/Module-Install/lib/Module/Install/Can.pm $ $Author: ingy $
 
3
# $Revision: #5 $ $Change: 1377 $ $DateTime: 2003/03/20 15:11:54 $ vim: expandtab shiftwidth=4
 
4
 
 
5
package Module::Install::Can;
 
6
use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
7
$VERSION = '0.01';
 
8
use strict;
 
9
 
 
10
# check if we can run some command
 
11
sub can_run {
 
12
    my ($self, $cmd) = @_;
 
13
 
 
14
    require Config;
 
15
    require File::Spec;
 
16
    require ExtUtils::MakeMaker;
 
17
 
 
18
    my $_cmd = $cmd;
 
19
    return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
 
20
 
 
21
    for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
 
22
        my $abs = File::Spec->catfile($dir, $_[1]);
 
23
        return $abs if (-x $abs or $abs = MM->maybe_command($abs));
 
24
    }
 
25
 
 
26
    return;
 
27
}
 
28
 
 
29
sub can_cc {
 
30
    my $self = shift;
 
31
    require Config;
 
32
    my $cc = $Config::Config{cc} or return;
 
33
    $self->can_run($cc);
 
34
}
 
35
 
 
36
1;