| 1 | package CPANPLUS::Selfupdate; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use Params::Check qw[check]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use IPC::Cmd qw[can_run]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 20 | ▶ | use CPANPLUS::Error qw[error msg]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 20 | ▶ | use Module::Load::Conditional qw[check_install]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 20 | ▶ | use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 20 | ▶ | use CPANPLUS::Internals::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 20 | ▶ | use vars qw[$VERSION]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 20 | $VERSION = "0.9912"; | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 20 | $Params::Check::VERBOSE = 1; | |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | CPANPLUS::Selfupdate - self-updating for CPANPLUS | ||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | $su = $cb->selfupdate_object; | ||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | @feats = $su->list_features; | ||||||||||||||||||||||||||||||||
| 26 | @feats = $su->list_enabled_features; | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | @mods = map { $su->modules_for_feature( $_ ) } @feats; | ||||||||||||||||||||||||||||||||
| 29 | @mods = $su->list_core_dependencies; | ||||||||||||||||||||||||||||||||
| 30 | @mods = $su->list_core_modules; | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | for ( @mods ) { | ||||||||||||||||||||||||||||||||
| 33 | print $_->name " should be version " . $_->version_required; | ||||||||||||||||||||||||||||||||
| 34 | print "Installed version is not uptodate!" | ||||||||||||||||||||||||||||||||
| 35 | unless $_->is_installed_version_sufficient; | ||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | $ok = $su->selfupdate( update => 'all', latest => 0 ); | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | =cut | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | ### a config has describing our deps etc | ||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | my $Modules = { | ||||||||||||||||||||||||||||||||
| 46 | dependencies => { | ||||||||||||||||||||||||||||||||
| 47 | 'File::Fetch' => '0.15_02', # lynx & 404 handling | ||||||||||||||||||||||||||||||||
| 48 | 'File::Spec' => '0.82', | ||||||||||||||||||||||||||||||||
| 49 | 'IPC::Cmd' => '0.36', # 5.6.2 compat: 2-arg open | ||||||||||||||||||||||||||||||||
| 50 | 'Locale::Maketext::Simple' => '0.01', | ||||||||||||||||||||||||||||||||
| 51 | 'Log::Message' => '0.01', | ||||||||||||||||||||||||||||||||
| 52 | 'Module::Load' => '0.10', | ||||||||||||||||||||||||||||||||
| 53 | 'Module::Load::Conditional' => '0.50', # returns dir for loaded | ||||||||||||||||||||||||||||||||
| 54 | # modules | ||||||||||||||||||||||||||||||||
| 55 | 'version' => '0.77', # needed for M::L::C | ||||||||||||||||||||||||||||||||
| 56 | # addresses #24630 and | ||||||||||||||||||||||||||||||||
| 57 | # #24675 | ||||||||||||||||||||||||||||||||
| 58 | # Address ~0 overflow issue | ||||||||||||||||||||||||||||||||
| 59 | 'Params::Check' => '0.36', | ||||||||||||||||||||||||||||||||
| 60 | 'Package::Constants' => '0.01', | ||||||||||||||||||||||||||||||||
| 61 | 'Term::UI' => '0.18', # option parsing | ||||||||||||||||||||||||||||||||
| 62 | 'Test::Harness' => '2.62', # due to bug #19505 | ||||||||||||||||||||||||||||||||
| 63 | # only 2.58 and 2.60 are bad | ||||||||||||||||||||||||||||||||
| 64 | 'Test::More' => '0.47', # to run our tests | ||||||||||||||||||||||||||||||||
| 65 | 'Archive::Extract' => '0.16', # ./Dir bug fix | ||||||||||||||||||||||||||||||||
| 66 | 'Archive::Tar' => '1.23', | ||||||||||||||||||||||||||||||||
| 67 | 'IO::Zlib' => '1.04', # needed for Archive::Tar | ||||||||||||||||||||||||||||||||
| 68 | 'Object::Accessor' => '0.44', # mk_aliases support | ||||||||||||||||||||||||||||||||
| 69 | 'Module::CoreList' => '2.22', # deprecated core modules | ||||||||||||||||||||||||||||||||
| 70 | 'Module::Pluggable' => '2.4', | ||||||||||||||||||||||||||||||||
| 71 | 'Module::Loaded' => '0.01', | ||||||||||||||||||||||||||||||||
| 72 | 'Parse::CPAN::Meta' => '1.4200', # config_requires support | ||||||||||||||||||||||||||||||||
| 73 | 'ExtUtils::Install' => '1.42', # uninstall outside @INC | ||||||||||||||||||||||||||||||||
| 74 | ( check_install( module => 'CPANPLUS::Dist::Build' ) | ||||||||||||||||||||||||||||||||
| 75 | && !check_install( module => 'CPANPLUS::Dist::Build', version => '0.60' ) | ||||||||||||||||||||||||||||||||
| 76 | ? ( 'CPANPLUS::Dist::Build' => '0.60' ) : () ), | ||||||||||||||||||||||||||||||||
| 77 | ( $^O eq 'MSWin32' ? ( 'Archive::Extract' => '0.86' ) : () ), # Fixes issue with AE and bintar on MSWin32 | ||||||||||||||||||||||||||||||||
| 78 | }, | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | features => { | ||||||||||||||||||||||||||||||||
| 81 | # config_key_name => [ | ||||||||||||||||||||||||||||||||
| 82 | # sub { } to list module key/value pairs | ||||||||||||||||||||||||||||||||
| 83 | # sub { } to check if feature is enabled | ||||||||||||||||||||||||||||||||
| 84 | # ] | ||||||||||||||||||||||||||||||||
| 85 | prefer_makefile => [ | ||||||||||||||||||||||||||||||||
| 86 | sub { | ||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $cb->configure_object->get_conf('prefer_makefile') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 89 | ? { } | ||||||||||||||||||||||||||||||||
| 90 | : { 'CPANPLUS::Dist::Build' => '0.60' }; | ||||||||||||||||||||||||||||||||
| 91 | }, | ||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub { return 1 }, # always enabled | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 93 | ], | ||||||||||||||||||||||||||||||||
| 94 | cpantest => [ | ||||||||||||||||||||||||||||||||
| 95 | { 'Test::Reporter' => '1.34', | ||||||||||||||||||||||||||||||||
| 96 | 'Parse::CPAN::Meta' => '1.4200' | ||||||||||||||||||||||||||||||||
| 97 | }, | ||||||||||||||||||||||||||||||||
| 98 | sub { | ||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 100 | 0 | return $cb->configure_object->get_conf('cpantest'); | |||||||||||||||||||||||||||||||
| 101 | }, | ||||||||||||||||||||||||||||||||
| 102 | ], | ||||||||||||||||||||||||||||||||
| 103 | dist_type => [ | ||||||||||||||||||||||||||||||||
| 104 | sub { | ||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 106 | 0 | my $dist = $cb->configure_object->get_conf('dist_type'); | |||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | return { $dist => '0.0' } if $dist; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 108 | 0 | return; | |||||||||||||||||||||||||||||||
| 109 | }, | ||||||||||||||||||||||||||||||||
| 110 | sub { | ||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 112 | 0 | return $cb->configure_object->get_conf('dist_type'); | |||||||||||||||||||||||||||||||
| 113 | }, | ||||||||||||||||||||||||||||||||
| 114 | ], | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | md5 => [ | ||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||
| 118 | 'Digest::SHA' => '0.0', | ||||||||||||||||||||||||||||||||
| 119 | }, | ||||||||||||||||||||||||||||||||
| 120 | sub { | ||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 122 | 0 | return $cb->configure_object->get_conf('md5'); | |||||||||||||||||||||||||||||||
| 123 | }, | ||||||||||||||||||||||||||||||||
| 124 | ], | ||||||||||||||||||||||||||||||||
| 125 | shell => [ | ||||||||||||||||||||||||||||||||
| 126 | sub { | ||||||||||||||||||||||||||||||||
| 127 | 3 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||
| 128 | 3 | my $dist = $cb->configure_object->get_conf('shell'); | |||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | ### we bundle these shells, so don't bother having a dep | ||||||||||||||||||||||||||||||||
| 131 | ### on them... If we don't do this, CPAN.pm actually detects | ||||||||||||||||||||||||||||||||
| 132 | ### a recursive dependency and breaks (see #26077). | ||||||||||||||||||||||||||||||||
| 133 | ### This is not an issue for CPANPLUS itself, it handles | ||||||||||||||||||||||||||||||||
| 134 | ### it smartly. | ||||||||||||||||||||||||||||||||
| 135 | 3 | ▶ | return if $dist eq SHELL_DEFAULT or $dist eq SHELL_CLASSIC; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$dist eq "CPANPLUS::Shell::Default" or $dist eq "CPANPLUS::Shell::Classic"
MC/DC100%2/2
$dist eq "CPANPLUS::Shell::Default" or $dist eq "CPANPLUS::Shell::Classic"
$dist eq "CPANPLUS::Shell::Default"
$dist eq "CPANPLUS::Shell::Classic"
Truth table100%3/3
A or B
A= $dist eq "CPANPLUS::Shell::Default"B= $dist eq "CPANPLUS::Shell::Classic"
| |||||||||||||||||||||||||||||||||
| 136 | 1 | ▶ | return { $dist => '0.0' } if $dist; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 137 | 0 | return; | |||||||||||||||||||||||||||||||
| 138 | }, | ||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub { return 1 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 140 | ], | ||||||||||||||||||||||||||||||||
| 141 | signature => [ | ||||||||||||||||||||||||||||||||
| 142 | sub { | ||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 144 | return { | ||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | 'Module::Signature' => '0.06', | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 146 | } if can_run('gpg'); | ||||||||||||||||||||||||||||||||
| 147 | ### leave this out -- Crypt::OpenPGP is fairly | ||||||||||||||||||||||||||||||||
| 148 | ### painful to install, and broken on some platforms | ||||||||||||||||||||||||||||||||
| 149 | ### so we'll just always fall back to gpg. It may | ||||||||||||||||||||||||||||||||
| 150 | ### issue a warning or 2, but that's about it. | ||||||||||||||||||||||||||||||||
| 151 | ### this change due to this ticket: #26914 | ||||||||||||||||||||||||||||||||
| 152 | # and $cb->configure_object->get_conf('prefer_bin'); | ||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | return { | ||||||||||||||||||||||||||||||||
| 155 | 0 | 'Crypt::OpenPGP' => '0.0', | |||||||||||||||||||||||||||||||
| 156 | 'Module::Signature' => '0.06', | ||||||||||||||||||||||||||||||||
| 157 | }; | ||||||||||||||||||||||||||||||||
| 158 | }, | ||||||||||||||||||||||||||||||||
| 159 | sub { | ||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 161 | 0 | return $cb->configure_object->get_conf('signature'); | |||||||||||||||||||||||||||||||
| 162 | }, | ||||||||||||||||||||||||||||||||
| 163 | ], | ||||||||||||||||||||||||||||||||
| 164 | storable => [ | ||||||||||||||||||||||||||||||||
| 165 | { 'Storable' => '0.0' }, | ||||||||||||||||||||||||||||||||
| 166 | sub { | ||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 168 | 0 | return $cb->configure_object->get_conf('storable'); | |||||||||||||||||||||||||||||||
| 169 | }, | ||||||||||||||||||||||||||||||||
| 170 | ], | ||||||||||||||||||||||||||||||||
| 171 | sqlite_backend => [ | ||||||||||||||||||||||||||||||||
| 172 | { 'DBIx::Simple' => '0.0', | ||||||||||||||||||||||||||||||||
| 173 | 'DBD::SQLite' => '0.0', | ||||||||||||||||||||||||||||||||
| 174 | }, | ||||||||||||||||||||||||||||||||
| 175 | sub { | ||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | my $cb = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 177 | 0 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||
| 178 | 0 | return $conf->get_conf('source_engine') | |||||||||||||||||||||||||||||||
| 179 | eq 'CPANPLUS::Internals::Source::SQLite' | ||||||||||||||||||||||||||||||||
| 180 | }, | ||||||||||||||||||||||||||||||||
| 181 | 20 | ▶ | ], | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
check_install("module", "CPANPLUS::Dist::Build") and not check_install("module", "CPANPLUS::Dist::Build", "version", "0.60")
MC/DC0%0/2
check_install("module", "CPANPLUS::Dist::Build") and not check_install("module", "CPANPLUS::Dist::Build", "version", "0.60")
check_install("module", "CPANPLUS::Dist::Build")
not check_install("module", "CPANPLUS::Dist::Build", "version", "0.60")
Truth table33%1/3
A and not(B)
A= check_install("module", "CPANPLUS::Dist::Build")B= not check_install("module", "CPANPLUS::Dist::Build", "version", "0.60")
| |||||||||||||||||||||||||||||||||
| 182 | }, | ||||||||||||||||||||||||||||||||
| 183 | core => { | ||||||||||||||||||||||||||||||||
| 184 | 'CPANPLUS' => '0.0', | ||||||||||||||||||||||||||||||||
| 185 | }, | ||||||||||||||||||||||||||||||||
| 186 | }; | ||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||
| 188 | 26 | ▶ | sub _get_config { return $Modules } | ||||||||||||||||||||||||||||||
|
Subroutine
_get_config: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | =head1 METHODS | ||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | =head2 $self = CPANPLUS::Selfupdate->new( $backend_object ); | ||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | Sets up a new selfupdate object. Called automatically when | ||||||||||||||||||||||||||||||||
| 196 | a new backend object is created. | ||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||
| 198 | =cut | ||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||
| 200 | 20 | sub new { | |||||||||||||||||||||||||||||||
| 201 | 14 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 202 | 14 | ▶ | my $cb = shift or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 203 | 14 | ▶ | return bless sub { $cb }, $class; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | { ### cache to find the relevant modules | ||||||||||||||||||||||||||||||||
| 208 | my $cache = { | ||||||||||||||||||||||||||||||||
| 209 | core | ||||||||||||||||||||||||||||||||
| 210 | 2 | ▶ | => sub { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 211 | 2 | core => [ $self->list_core_modules ] }, | |||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | dependencies | ||||||||||||||||||||||||||||||||
| 214 | 1 | ▶ | => sub { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 215 | 1 | dependencies => [ $self->list_core_dependencies ] }, | |||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | enabled_features | ||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | => sub { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 219 | 1 | map { $_ => [ $self->modules_for_feature( $_ ) ] } | |||||||||||||||||||||||||||||||
| 220 | $self->list_enabled_features | ||||||||||||||||||||||||||||||||
| 221 | }, | ||||||||||||||||||||||||||||||||
| 222 | features | ||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | => sub { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 224 | 0 | map { $_ => [ $self->modules_for_feature( $_ ) ] } | |||||||||||||||||||||||||||||||
| 225 | $self->list_features | ||||||||||||||||||||||||||||||||
| 226 | }, | ||||||||||||||||||||||||||||||||
| 227 | ### make sure to do 'core' first, in case | ||||||||||||||||||||||||||||||||
| 228 | ### we are out of date ourselves | ||||||||||||||||||||||||||||||||
| 229 | 20 | all => [ qw|core dependencies enabled_features| ], | |||||||||||||||||||||||||||||||
| 230 | }; | ||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | =head2 @cat = $self->list_categories | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | Returns a list of categories that the C<selfupdate> method accepts. | ||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | See C<selfupdate> for details. | ||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||
| 239 | =cut | ||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | sub list_categories { return sort keys %$cache } | ||||||||||||||||||||||||||||||
|
Subroutine
list_categories: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||
| 243 | =head2 %list = $self->list_modules_to_update( update => "core|dependencies|enabled_features|features|all", [latest => BOOL] ) | ||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||
| 245 | List which modules C<selfupdate> would upgrade. You can update either | ||||||||||||||||||||||||||||||||
| 246 | the core (CPANPLUS itself), the core dependencies, all features you have | ||||||||||||||||||||||||||||||||
| 247 | currently turned on, or all features available, or everything. | ||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | The C<latest> option determines whether it should update to the latest | ||||||||||||||||||||||||||||||||
| 250 | version on CPAN, or if the minimal required version for CPANPLUS is | ||||||||||||||||||||||||||||||||
| 251 | good enough. | ||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | Returns a hash of feature names and lists of module objects to be | ||||||||||||||||||||||||||||||||
| 254 | upgraded based on the category you provided. For example: | ||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||
| 256 | %list = $self->list_modules_to_update( update => 'core' ); | ||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | Would return: | ||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||
| 260 | ( core => [ $module_object_for_cpanplus ] ); | ||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||
| 264 | sub list_modules_to_update { | ||||||||||||||||||||||||||||||||
| 265 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
list_modules_to_update: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 266 | 2 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 267 | 2 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||
| 268 | 2 | my %hash = @_; | |||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||
| 270 | 2 | my($type, $latest); | |||||||||||||||||||||||||||||||
| 271 | 2 | my $tmpl = { | |||||||||||||||||||||||||||||||
| 272 | update => { required => 1, store => \$type, | ||||||||||||||||||||||||||||||||
| 273 | allow => [ keys %$cache ], }, | ||||||||||||||||||||||||||||||||
| 274 | latest => { default => 0, store => \$latest, allow => BOOLEANS }, | ||||||||||||||||||||||||||||||||
| 275 | }; | ||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||
| 277 | 2 | { local $Params::Check::ALLOW_UNKNOWN = 1; | |||||||||||||||||||||||||||||||
| 278 | 2 | ▶ | check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||
| 281 | 2 | my $ref = $cache->{$type}; | |||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | ### a list of ( feature1 => \@mods, feature2 => \@mods, etc ) | ||||||||||||||||||||||||||||||||
| 284 | my %list = UNIVERSAL::isa( $ref, 'ARRAY' ) | ||||||||||||||||||||||||||||||||
| 285 | 2 | ▶ | ? map { $cache->{$_}->( $self ) } @$ref | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 286 | : $ref->( $self ); | ||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||
| 288 | ### filter based on whether we need the latest ones or not | ||||||||||||||||||||||||||||||||
| 289 | 2 | for my $aref ( values %list ) { | |||||||||||||||||||||||||||||||
| 290 | $aref = [ $latest | ||||||||||||||||||||||||||||||||
| 291 | 1 | ? grep { !$_->is_uptodate } @$aref | |||||||||||||||||||||||||||||||
| 292 | 4 | ▶ | : grep { !$_->is_installed_version_sufficient } @$aref | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 293 | ]; | ||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||
| 296 | 2 | return %list; | |||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||
| 299 | =head2 $bool = $self->selfupdate( update => "core|dependencies|enabled_features|features|all", [latest => BOOL, force => BOOL] ) | ||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | Selfupdate CPANPLUS. You can update either the core (CPANPLUS itself), | ||||||||||||||||||||||||||||||||
| 302 | the core dependencies, all features you have currently turned on, or | ||||||||||||||||||||||||||||||||
| 303 | all features available, or everything. | ||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||
| 305 | The C<latest> option determines whether it should update to the latest | ||||||||||||||||||||||||||||||||
| 306 | version on CPAN, or if the minimal required version for CPANPLUS is | ||||||||||||||||||||||||||||||||
| 307 | good enough. | ||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||
| 309 | Returns true on success, false on error. | ||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||
| 311 | =cut | ||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||
| 313 | sub selfupdate { | ||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
selfupdate: called CC=6 SCAR=19.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 315 | 1 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 316 | 1 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||
| 317 | 1 | my %hash = @_; | |||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||
| 319 | 1 | my $force; | |||||||||||||||||||||||||||||||
| 320 | 1 | my $tmpl = { | |||||||||||||||||||||||||||||||
| 321 | force => { default => $conf->get_conf('force'), store => \$force }, | ||||||||||||||||||||||||||||||||
| 322 | }; | ||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||
| 324 | 1 | { local $Params::Check::ALLOW_UNKNOWN = 1; | |||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||
| 328 | 1 | ▶ | my %list = $self->list_modules_to_update( %hash ) or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||
| 330 | ### just the modules please | ||||||||||||||||||||||||||||||||
| 331 | 1 | my @mods = map { @$_ } values %list; | |||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||
| 333 | 1 | my $flag; | |||||||||||||||||||||||||||||||
| 334 | 1 | for my $mod ( @mods ) { | |||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | unless( $mod->install( force => $force ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 336 | 0 | $flag++; | |||||||||||||||||||||||||||||||
| 337 | 0 | error(loc("Failed to update module '%1'", $mod->name)); | |||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | return if $flag; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 342 | 1 | return 1; | |||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||
| 347 | =head2 @features = $self->list_features | ||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||
| 349 | Returns a list of features that are supported by CPANPLUS. | ||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | =cut | ||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||
| 353 | 20 | sub list_features { | |||||||||||||||||||||||||||||||
| 354 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
list_features: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 355 | 3 | return keys %{ $self->_get_config->{'features'} }; | |||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||
| 358 | =head2 @features = $self->list_enabled_features | ||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||
| 360 | Returns a list of features that are enabled in your current | ||||||||||||||||||||||||||||||||
| 361 | CPANPLUS installation. | ||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | =cut | ||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | sub list_enabled_features { | ||||||||||||||||||||||||||||||||
| 366 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
list_enabled_features: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 367 | 2 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||
| 369 | 2 | my @enabled; | |||||||||||||||||||||||||||||||
| 370 | 2 | for my $feat ( $self->list_features ) { | |||||||||||||||||||||||||||||||
| 371 | 2 | my $ref = $self->_get_config->{'features'}->{$feat}->[1]; | |||||||||||||||||||||||||||||||
| 372 | 2 | ▶ | push @enabled, $feat if $ref->($cb); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | 2 | return @enabled; | |||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||
| 378 | =head2 @mods = $self->modules_for_feature( FEATURE [,AS_HASH] ) | ||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||
| 380 | Returns a list of C<CPANPLUS::Selfupdate::Module> objects which | ||||||||||||||||||||||||||||||||
| 381 | represent the modules required to support this feature. | ||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||
| 383 | For a list of features, call the C<list_features> method. | ||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||
| 385 | If the C<AS_HASH> argument is provided, no module objects are | ||||||||||||||||||||||||||||||||
| 386 | returned, but a hashref where the keys are names of the modules, | ||||||||||||||||||||||||||||||||
| 387 | and values are their minimum versions. | ||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||
| 391 | sub modules_for_feature { | ||||||||||||||||||||||||||||||||
| 392 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
modules_for_feature: called CC=7 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 393 | 6 | ▶ | my $feature = shift or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 394 | 6 | ▶ | my $as_hash = shift || 0; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||
| 395 | 6 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||
| 397 | 6 | ▶ | unless( exists $self->_get_config->{'features'}->{$feature} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 398 | 0 | error(loc("Unknown feature '%1'", $feature)); | |||||||||||||||||||||||||||||||
| 399 | 0 | return; | |||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||
| 402 | 6 | my $ref = $self->_get_config->{'features'}->{$feature}->[0]; | |||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||
| 404 | ### it's either a list of modules/versions or a subroutine that | ||||||||||||||||||||||||||||||||
| 405 | ### returns a list of modules/versions | ||||||||||||||||||||||||||||||||
| 406 | 6 | ▶ | my $href = UNIVERSAL::isa( $ref, 'HASH' ) ? $ref : $ref->( $cb ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||
| 408 | 6 | ▶ | return unless $href; # nothing needed for the feature? | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||
| 410 | 4 | ▶ | return $href if $as_hash; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 411 | 2 | return $self->_hashref_to_module( $href ); | |||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||
| 415 | =head2 @mods = $self->list_core_dependencies( [AS_HASH] ) | ||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||
| 417 | Returns a list of C<CPANPLUS::Selfupdate::Module> objects which | ||||||||||||||||||||||||||||||||
| 418 | represent the modules that comprise the core dependencies of CPANPLUS. | ||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||
| 420 | If the C<AS_HASH> argument is provided, no module objects are | ||||||||||||||||||||||||||||||||
| 421 | returned, but a hashref where the keys are names of the modules, | ||||||||||||||||||||||||||||||||
| 422 | and values are their minimum versions. | ||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||
| 424 | =cut | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | sub list_core_dependencies { | ||||||||||||||||||||||||||||||||
| 427 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
list_core_dependencies: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 428 | 3 | ▶ | my $as_hash = shift || 0; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||
| 429 | 3 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 430 | 3 | my $href = $self->_get_config->{'dependencies'}; | |||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||
| 432 | 3 | ▶ | return $href if $as_hash; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 433 | 2 | return $self->_hashref_to_module( $href ); | |||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||
| 436 | =head2 @mods = $self->list_core_modules( [AS_HASH] ) | ||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||
| 438 | Returns a list of C<CPANPLUS::Selfupdate::Module> objects which | ||||||||||||||||||||||||||||||||
| 439 | represent the modules that comprise the core of CPANPLUS. | ||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||
| 441 | If the C<AS_HASH> argument is provided, no module objects are | ||||||||||||||||||||||||||||||||
| 442 | returned, but a hashref where the keys are names of the modules, | ||||||||||||||||||||||||||||||||
| 443 | and values are their minimum versions. | ||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||
| 445 | =cut | ||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||
| 447 | sub list_core_modules { | ||||||||||||||||||||||||||||||||
| 448 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
list_core_modules: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 449 | 4 | ▶ | my $as_hash = shift || 0; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||
| 450 | 4 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 451 | 4 | my $href = $self->_get_config->{'core'}; | |||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||
| 453 | 4 | ▶ | return $href if $as_hash; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 454 | 3 | return $self->_hashref_to_module( $href ); | |||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||
| 457 | sub _hashref_to_module { | ||||||||||||||||||||||||||||||||
| 458 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_hashref_to_module: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 459 | 7 | my $cb = $self->(); | |||||||||||||||||||||||||||||||
| 460 | 7 | ▶ | my $href = shift or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||
| 462 | return map { | ||||||||||||||||||||||||||||||||
| 463 | 7 | CPANPLUS::Selfupdate::Module->new( | |||||||||||||||||||||||||||||||
| 464 | 7 | $cb->module_tree($_) => $href->{$_} | |||||||||||||||||||||||||||||||
| 465 | ) | ||||||||||||||||||||||||||||||||
| 466 | } keys %$href; | ||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||
| 470 | =head1 CPANPLUS::Selfupdate::Module | ||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||
| 472 | C<CPANPLUS::Selfupdate::Module> extends C<CPANPLUS::Module> objects | ||||||||||||||||||||||||||||||||
| 473 | by providing accessors to aid in selfupdating CPANPLUS. | ||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||
| 475 | These objects are returned by all methods of C<CPANPLUS::Selfupdate> | ||||||||||||||||||||||||||||||||
| 476 | that return module objects. | ||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||
| 478 | =cut | ||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||
| 480 | { package CPANPLUS::Selfupdate::Module; | ||||||||||||||||||||||||||||||||
| 481 | 20 | ▶ | use base 'CPANPLUS::Module'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||
| 483 | ### stores module name -> cpanplus required version | ||||||||||||||||||||||||||||||||
| 484 | ### XXX only can deal with 1 pair! | ||||||||||||||||||||||||||||||||
| 485 | 20 | my %Cache = (); | |||||||||||||||||||||||||||||||
| 486 | 20 | my $Acc = 'version_required'; | |||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||
| 488 | sub new { | ||||||||||||||||||||||||||||||||
| 489 | 7 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||
| 490 | 7 | ▶ | my $mod = shift or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 491 | 7 | ▶ | my $ver = shift; return unless defined $ver; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||
| 493 | 7 | my $obj = $mod->clone; # clone the module object | |||||||||||||||||||||||||||||||
| 494 | 7 | bless $obj, $class; # rebless it to our class | |||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||
| 496 | 7 | $obj->$Acc( $ver ); | |||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||
| 498 | 7 | return $obj; | |||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||
| 501 | =head2 $version = $mod->version_required | ||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||
| 503 | Returns the version of this module required for CPANPLUS. | ||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||
| 505 | =cut | ||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||
| 507 | sub version_required { | ||||||||||||||||||||||||||||||||
| 508 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
version_required: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 509 | 11 | ▶ | $Cache{ $self->name } = shift() if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 510 | 11 | return $Cache{ $self->name }; | |||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||
| 513 | =head2 $bool = $mod->is_installed_version_sufficient | ||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||
| 515 | Returns true if the installed version of this module is sufficient | ||||||||||||||||||||||||||||||||
| 516 | for CPANPLUS, or false if it is not. | ||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||
| 518 | =cut | ||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||
| 521 | sub is_installed_version_sufficient { | ||||||||||||||||||||||||||||||||
| 522 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
is_installed_version_sufficient: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 523 | 4 | return $self->is_uptodate( version => $self->$Acc ); | |||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||
| 528 | 20 | 1; | |||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||
| 530 | =pod | ||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||
| 532 | =head1 BUG REPORTS | ||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | Please report bugs or other issues to E<lt>bug-cpanplus@rt.cpan.org<gt>. | ||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||
| 536 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||
| 538 | This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. | ||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||
| 540 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||
| 542 | The CPAN++ interface (of which this module is a part of) is copyright (c) | ||||||||||||||||||||||||||||||||
| 543 | 2001 - 2007, Jos Boumans E<lt>kane@cpan.orgE<gt>. All rights reserved. | ||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||
| 545 | This library is free software; you may redistribute and/or modify it | ||||||||||||||||||||||||||||||||
| 546 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||
| 548 | =cut | ||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||
| 550 | # Local variables: | ||||||||||||||||||||||||||||||||
| 551 | # c-indentation-style: bsd | ||||||||||||||||||||||||||||||||
| 552 | # c-basic-offset: 4 | ||||||||||||||||||||||||||||||||
| 553 | # indent-tabs-mode: nil | ||||||||||||||||||||||||||||||||
| 554 | # End: | ||||||||||||||||||||||||||||||||
| 555 | # vim: expandtab shiftwidth=4: | ||||||||||||||||||||||||||||||||