Commit | Line | Data |
54123ee5 |
1 | #line 1 |
2 | package Module::Install::AutoInstall; |
3 | |
4 | use Module::Install::Base; |
5 | @ISA = qw{Module::Install::Base}; |
6 | |
7 | $VERSION = '0.61'; |
8 | |
9 | use strict; |
10 | |
11 | sub AutoInstall { $_[0] } |
12 | |
13 | sub run { |
14 | my $self = shift; |
15 | $self->auto_install_now(@_); |
16 | } |
17 | |
18 | sub write { |
19 | my $self = shift; |
20 | $self->auto_install(@_); |
21 | } |
22 | |
23 | sub auto_install { |
24 | my $self = shift; |
25 | return if $self->{done}++; |
26 | |
27 | # Flatten array of arrays into a single array |
28 | my @core = map @$_, map @$_, grep ref, |
29 | $self->build_requires, $self->requires; |
30 | |
31 | my @config = @_; |
32 | |
33 | # We'll need Module::AutoInstall |
34 | $self->include('Module::AutoInstall'); |
35 | require Module::AutoInstall; |
36 | |
37 | Module::AutoInstall->import( |
38 | (@config ? (-config => \@config) : ()), |
39 | (@core ? (-core => \@core) : ()), |
40 | $self->features, |
41 | ); |
42 | |
43 | $self->makemaker_args( Module::AutoInstall::_make_args() ); |
44 | |
45 | my $class = ref($self); |
46 | $self->postamble( |
47 | "# --- $class section:\n" . |
48 | Module::AutoInstall::postamble() |
49 | ); |
50 | } |
51 | |
52 | sub auto_install_now { |
53 | my $self = shift; |
54 | $self->auto_install(@_); |
55 | Module::AutoInstall::do_install(); |
56 | } |
57 | |
58 | 1; |