| 1 | package Module::Install::Admin::Bundle; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 46 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 46 | ▶ | use Module::Install::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 46 | ▶ | use vars qw{$VERSION @ISA}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 46 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 46 | $VERSION = '1.21'; | |||||||||||||||||||||||||||
| 9 | 46 | @ISA = qw{Module::Install::Base}; | |||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub bundle { | ||||||||||||||||||||||||||
|
Subroutine
bundle: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 14 | 0 | my $bundle_dir = $self->_top->{bundle}; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | require Cwd; | |||||||||||||||||||||||||||
| 17 | 0 | require CPANPLUS::Backend; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | my $cwd = Cwd::getcwd(); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 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; | ||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||
| 25 | # Jos Boumans tells us that this is the best way to do what we want | ||||||||||||||||||||||||||||
| 26 | # It still scares me. | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my $cp = CPANPLUS::Internals->_retrieve_id( CPANPLUS::Internals->_last_id ) | ||||||||||||||||||||||||||
|
Condition0%0/3
'CPANPLUS::Internals'->_retrieve_id('CPANPLUS::Internals'->_last_id) || 'CPANPLUS::Backend'->new
MC/DC0%0/2
'CPANPLUS::Internals'->_retrieve_id('CPANPLUS::Internals'->_last_id) || 'CPANPLUS::Backend'->new
'CPANPLUS::Internals'->_retrieve_id('CPANPLUS::Internals'->_last_id)
'CPANPLUS::Backend'->new
Truth table0%0/3
A || B
A= 'CPANPLUS::Internals'->_retrieve_id('CPANPLUS::Internals'->_last_id)B= 'CPANPLUS::Backend'->new
| |||||||||||||||||||||||||||||
| 28 | || CPANPLUS::Backend->new; | ||||||||||||||||||||||||||||
| 29 | 0 | my $conf = $cp->configure_object; | |||||||||||||||||||||||||||
| 30 | 0 | my $modtree = $cp->module_tree; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | $conf->set_conf( verbose => 1 ); | |||||||||||||||||||||||||||
| 33 | 0 | $conf->set_conf( signature => 0 ); | |||||||||||||||||||||||||||
| 34 | 0 | $conf->set_conf( md5 => 0 ); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | mkdir( $bundle_dir, 0777 ); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | while ( my ( $name, $version ) = splice( @_, 0, 2 ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | my $mod = $cp->module_tree($name); | |||||||||||||||||||||||||||
| 40 | 0 | ▶ | if (not $mod) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | warn "Warning: Could not find distribution for module $name on CPAN. Bundle it manually.\n"; | |||||||||||||||||||||||||||
| 42 | 0 | next; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( $mod->package_is_perl_core or $self->{already_bundled}{$mod->package} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mod->package_is_perl_core or $self->{"already_bundled"}{$mod->package}
MC/DC0%0/2
$mod->package_is_perl_core or $self->{"already_bundled"}{$mod->package}
$mod->package_is_perl_core
$self->{"already_bundled"}{$mod->package}
Truth table0%0/3
A or B
A= $mod->package_is_perl_coreB= $self->{"already_bundled"}{$mod->package}
| |||||||||||||||||||||||||||||
| 46 | 0 | next; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | my $where = $mod->fetch( fetchdir => $bundle_dir, ); | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | unless ($where) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | warn "Warning: Could not download distribution $bundle_dir. Download it manually.\n"; | |||||||||||||||||||||||||||
| 52 | 0 | next; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 0 | my $file = Cwd::abs_path($where); | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my $extract_result = $mod->extract( | |||||||||||||||||||||||||||
| 57 | files => [ $file ], | ||||||||||||||||||||||||||||
| 58 | extractdir => $bundle_dir, | ||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | unlink $file; | |||||||||||||||||||||||||||
| 62 | 0 | ▶ | unless ($extract_result) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 0 | warn "Warning: Could not extract distribution $bundle_dir. Extract it manually.\n"; | |||||||||||||||||||||||||||
| 64 | 0 | next; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | $self->{already_bundled}{ $mod->package }++; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | chdir $cwd; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 46 | 1; | |||||||||||||||||||||||||||