Load XML-Feed-0.01 into trunk.
[catagits/XML-Feed.git] / inc / Module / Install / AutoInstall.pm
1 #line 1 "inc/Module/Install/AutoInstall.pm - /Library/Perl/5.8.1/Module/Install/AutoInstall.pm"
2 # $File: //depot/cpan/Module-Install/lib/Module/Install/AutoInstall.pm $ $Author: autrijus $
3 # $Revision: #13 $ $Change: 1846 $ $DateTime: 2003/12/31 22:57:12 $ 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     while ( @core and @_ > 1 and $_[0] =~ /^-\w+$/ ) {
43         push @core, splice(@_, 0, 2);
44     }
45
46     ExtUtils::AutoInstall->import(
47         (@core ? (-core => \@core) : ()), @_, $self->features
48     );
49
50     $self->makemaker_args( ExtUtils::AutoInstall::_make_args() );
51
52     my $class = ref($self);
53     $self->postamble(
54         "# --- $class section:\n" .
55         ExtUtils::AutoInstall::postamble()
56     );
57 }
58
59 sub auto_install_now {
60     my $self = shift;
61     $self->auto_install;
62     ExtUtils::AutoInstall::do_install();
63 }
64
65 1;