Apache-AuthTypeKey
view release on metacpan or search on metacpan
inc/ExtUtils/AutoInstall.pm view on Meta::CPAN
#line 1 "inc/ExtUtils/AutoInstall.pm - /Library/Perl/5.8.1/ExtUtils/AutoInstall.pm"
# $File: //member/autrijus/ExtUtils-AutoInstall/lib/ExtUtils/AutoInstall.pm $
# $Revision: #9 $ $Change: 9532 $ $DateTime: 2004/01/01 06:47:30 $ vim: expandtab shiftwidth=4
package ExtUtils::AutoInstall;
$ExtUtils::AutoInstall::VERSION = '0.56';
use strict;
use Cwd ();
use ExtUtils::MakeMaker ();
#line 282
# special map on pre-defined feature sets
my %FeatureMap = (
'' => 'Core Features', # XXX: deprecated
'-core' => 'Core Features',
);
# various lexical flags
my (@Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS);
my ($Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly);
my ($PostambleActions, $PostambleUsed);
$AcceptDefault = 1 unless -t STDIN; # non-interactive session
_init();
sub missing_modules {
return @Missing;
}
sub do_install {
__PACKAGE__->install(
[ UNIVERSAL::isa($Config, 'HASH') ? %{$Config} : @{$Config}],
@Missing,
);
}
# initialize various flags, and/or perform install
sub _init {
foreach my $arg (@ARGV, split(/[\s\t]+/, $ENV{PERL_EXTUTILS_AUTOINSTALL} || '')) {
if ($arg =~ /^--config=(.*)$/) {
$Config = [ split(',', $1) ];
}
elsif ($arg =~ /^--installdeps=(.*)$/) {
__PACKAGE__->install($Config, @Missing = split(/,/, $1));
exit 0;
}
elsif ($arg =~ /^--default(?:deps)?$/) {
$AcceptDefault = 1;
}
elsif ($arg =~ /^--check(?:deps)?$/) {
$CheckOnly = 1;
}
elsif ($arg =~ /^--skip(?:deps)?$/) {
$SkipInstall = 1;
}
elsif ($arg =~ /^--test(?:only)?$/) {
$TestOnly = 1;
}
}
}
inc/ExtUtils/AutoInstall.pm view on Meta::CPAN
foreach my $inc (grep { m/$pathname.pm/i } keys(%INC)) {
delete $INC{$inc};
}
my $rv = $cp->install( modules => [ $obj->{module} ]);
if ($rv and ($rv->{$obj->{module}} or $rv->{ok})) {
print "*** $pkg successfully installed.\n";
$success = 1;
}
else {
print "*** $pkg installation cancelled.\n";
$success = 0;
}
$installed += $success;
}
else {
print << ".";
*** Could not find a version $ver or above for $pkg; skipping.
.
}
MY::postinstall($pkg, $ver, $success) if defined &MY::postinstall;
}
return $installed;
}
sub _install_cpan {
my @modules = @{+shift};
my @config = @{+shift};
my $installed = 0;
my %args;
require CPAN; CPAN::Config->load;
return unless _can_write(MM->catfile($CPAN::Config->{cpan_home}, 'sources'));
# if we're root, set UNINST=1 to avoid trouble unless user asked for it.
my $makeflags = $CPAN::Config->{make_install_arg} || '';
$CPAN::Config->{make_install_arg} = join(' ', split(' ', $makeflags), 'UNINST=1')
if ($makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' });
# don't show start-up info
$CPAN::Config->{inhibit_startup_message} = 1;
# set additional options
while (my ($opt, $arg) = splice(@config, 0, 2)) {
($args{$opt} = $arg, next)
if $opt =~ /^force$/; # pseudo-option
$CPAN::Config->{$opt} = $arg;
}
while (my ($pkg, $ver) = splice(@modules, 0, 2)) {
MY::preinstall($pkg, $ver) or next if defined &MY::preinstall;
print "*** Installing $pkg...\n";
my $obj = CPAN::Shell->expand(Module => $pkg);
my $success = 0;
if ($obj and defined(_version_check($obj->cpan_version, $ver))) {
my $pathname = $pkg; $pathname =~ s/::/\\W/;
foreach my $inc (grep { m/$pathname.pm/i } keys(%INC)) {
delete $INC{$inc};
}
$obj->force('install') if $args{force};
if ($obj->install eq 'YES') {
print "*** $pkg successfully installed.\n";
$success = 1;
}
else {
print "*** $pkg installation failed.\n";
$success = 0;
}
$installed += $success;
}
else {
print << ".";
*** Could not find a version $ver or above for $pkg; skipping.
.
}
MY::postinstall($pkg, $ver, $success) if defined &MY::postinstall;
}
return $installed;
}
sub _has_cpanplus {
return (
$HasCPANPLUS = (
$INC{'CPANPLUS/Config.pm'} or
_load('CPANPLUS::Shell::Default')
)
);
}
# make guesses on whether we're under the CPAN installation directory
sub _under_cpan {
require Cwd;
require File::Spec;
my $cwd = File::Spec->canonpath(Cwd::cwd());
my $cpan = File::Spec->canonpath($CPAN::Config->{cpan_home});
return (index($cwd, $cpan) > -1);
}
sub _update_to {
my $class = __PACKAGE__;
my $ver = shift;
return if defined(_version_check(_load($class), $ver)); # no need to upgrade
( run in 0.730 second using v1.01-cache-2.11-cpan-5623c5533a1 )