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

« back to all changes in this revision

Viewing changes to inc/Module/Install/AutoInstall.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/AutoInstall.pm - /usr/local/lib/perl5/site_perl/5.8.0/Module/Install/AutoInstall.pm"
 
2
# $File: //depot/cpan/Module-Install/lib/Module/Install/AutoInstall.pm $ $Author: autrijus $
 
3
# $Revision: #12 $ $Change: 1481 $ $DateTime: 2003/05/07 10:41:22 $ vim: expandtab shiftwidth=4
 
4
 
 
5
package Module::Install::AutoInstall;
 
6
use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
7
 
 
8
sub AutoInstall { $_[0] }
 
9
 
 
10
sub run {
 
11
    my $self = shift;
 
12
    $self->auto_install_now(@_);
 
13
}
 
14
 
 
15
sub write {
 
16
    my $self = shift;
 
17
    $self->auto_install(@_);
 
18
}
 
19
 
 
20
sub auto_install {
 
21
    my $self = shift;
 
22
    return if $self->{done}++;
 
23
 
 
24
# ExtUtils::AutoInstall Bootstrap Code, version 7.
 
25
AUTO:{my$p='ExtUtils::AutoInstall';my$v=0.49;$p->VERSION||0>=$v
 
26
or+eval"use $p $v;1"or+do{my$e=$ENV{PERL_EXTUTILS_AUTOINSTALL};
 
27
(!defined($e)||$e!~m/--(?:default|skip|testonly)/and-t STDIN or
 
28
eval"use ExtUtils::MakeMaker;WriteMakefile(PREREQ_PM=>{'$p',$v}
 
29
);1"and exit)and print"==> $p $v required. Install it from CP".
 
30
"AN? [Y/n] "and<STDIN>!~/^n/i and print"*** Installing $p\n"and
 
31
do{if (eval '$>' and lc(`sudo -V`) =~ /version/){system('sudo',
 
32
$^X,"-MCPANPLUS","-e","CPANPLUS::install $p");eval"use $p $v;1"
 
33
||system('sudo', $^X, "-MCPAN", "-e", "CPAN::install $p")}eval{
 
34
require CPANPLUS;CPANPLUS::install$p};eval"use $p $v;1"or eval{
 
35
require CPAN;CPAN::install$p};eval"use $p $v;1"||die"*** Please
 
36
manually install $p $v from cpan.org first...\n"}}}
 
37
 
 
38
    # Flatten array of arrays into a single array
 
39
    my @core = map @$_, map @$_, grep ref,
 
40
               $self->build_requires, $self->requires;
 
41
 
 
42
    ExtUtils::AutoInstall->import(
 
43
        (@core ? (-core => \@core) : ()), @_, $self->features
 
44
    );
 
45
 
 
46
    $self->makemaker_args( ExtUtils::AutoInstall::_make_args() );
 
47
 
 
48
    my $class = ref($self);
 
49
    $self->postamble(
 
50
        "# --- $class section:\n" .
 
51
        ExtUtils::AutoInstall::postamble()
 
52
    );
 
53
}
 
54
 
 
55
sub auto_install_now {
 
56
    my $self = shift;
 
57
    $self->auto_install;
 
58
    ExtUtils::AutoInstall::do_install();
 
59
}
 
60
 
 
61
1;