1 package Module::Install::Admin::Bundle;
4 use Module::Install::Base;
6 use vars qw{$VERSION @ISA};
9 @ISA = qw{Module::Install::Base};
14 my $bundle_dir = $self->_top->{bundle};
17 require CPANPLUS::Backend;
19 my $cwd = Cwd::getcwd();
21 # This code is what we _should_ be doing, but CPANPLUS doesn't
22 # let you have multiple Backends in one program.
23 # my $cp = CPANPLUS::Backend->new;
25 # Jos Boumans tells us that this is the best way to do what we want
27 my $cp = CPANPLUS::Internals->_retrieve_id( CPANPLUS::Internals->_last_id )
28 || CPANPLUS::Backend->new;
29 my $conf = $cp->configure_object;
30 my $modtree = $cp->module_tree;
32 $conf->set_conf( verbose => 1 );
33 $conf->set_conf( signature => 0 );
34 $conf->set_conf( md5 => 0 );
40 while ( my ( $name, $version ) = splice( @_, 0, 2 ) ) {
41 my $mod = $cp->module_tree($name);
43 if ( $mod->package_is_perl_core or $self->{already_bundled}{$mod->package} ) {
47 my $where = $mod->fetch( fetchdir => $bundle_dir, );
49 my $file = Cwd::abs_path($where);
51 my $extract_result = $mod->extract(
53 extractdir => $bundle_dir,
57 next unless ($extract_result);
58 $bundles{$name} = $extract_result;
59 $self->{already_bundled}{ $mod->package }++;
66 open FH, ">> $bundle_dir.yml" or die "Cannot write to $bundle_dir.yml: $!";
67 foreach my $name ( sort keys %bundles ) {
68 print FH "$name: '$bundles{$name}'\n";