1 package CPANPLUS::Dist::Autobundle;
5 use CPANPLUS::Error qw[error msg];
6 use Params::Check qw[check];
7 use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext';
9 use base qw[CPANPLUS::Dist::Base];
13 CPANPLUS::Dist::Autobundle
17 $modobj = $cb->parse_module( module => 'file://path/to/Snapshot_XXYY.pm' );
22 C<CPANPLUS::Dist::Autobundle> is a distribution class for installing installation
23 snapshots as created by C<CPANPLUS>' C<autobundle> command.
25 All modules as mentioned in the snapshot will be installed on your system.
31 my $status = $dist->status;
33 $status->mk_accessors(
34 qw[prepared created installed _prepare_args _create_args _install_args]
44 ### store the arguments, so ->install can use them in recursive loops ###
45 $dist->status->_prepare_args( \%args );
47 return $dist->status->prepared( 1 );
52 my $self = $dist->parent;
54 ### we're also the cpan_dist, since we don't need to have anything
56 $dist = $self->status->dist_cpan if $self->status->dist_cpan;
57 $self->status->dist_cpan( $dist ) unless $self->status->dist_cpan;
59 my $cb = $self->parent;
60 my $conf = $cb->configure_object;
63 my( $force, $verbose, $prereq_target, $prereq_format, $prereq_build);
66 local $Params::Check::ALLOW_UNKNOWN = 1;
68 force => { default => $conf->get_conf('force'),
70 verbose => { default => $conf->get_conf('verbose'),
72 prereq_target => { default => '', store => \$prereq_target },
74 ### don't set the default prereq format to 'makemaker' -- wrong!
75 prereq_format => { #default => $self->status->installer_type,
77 store => \$prereq_format },
78 prereq_build => { default => 0, store => \$prereq_build },
81 check( $tmpl, \%hash ) or return;
84 ### maybe we already ran a create on this object? ###
85 return 1 if $dist->status->created && !$force;
87 ### store the arguments, so ->install can use them in recursive loops ###
88 $dist->status->_create_args( \%hash );
90 msg(loc("Resolving prerequisites mentioned in the bundle"), $verbose);
92 ### this will set the directory back to the start
93 ### dir, so we must chdir /again/
94 my $ok = $dist->_resolve_prereqs(
95 format => $prereq_format,
97 prereqs => $self->status->prereqs,
98 target => $prereq_target,
100 prereq_build => $prereq_build,
103 ### if all went well, mark it & return
104 return $dist->status->created( $ok ? 1 : 0);
111 ### store the arguments, so ->install can use them in recursive loops ###
112 $dist->status->_install_args( \%args );
114 return $dist->status->installed( 1 );