| 1 | # $Id: META.pm 84 2020-05-31 06:29:34Z stro $ | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package CPAN::SQLite::META; | ||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | our $VERSION = '0.219'; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use English qw/-no_match_vars/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | require CPAN::SQLite; | ||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use DBI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use parent 'Exporter'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | our @EXPORT_OK; | ||||||||||||||||||||||||||||
| 16 | @EXPORT_OK = qw(setup update check); | ||||||||||||||||||||||||||||
| 17 | our $global_id; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # This is usually already defined in real life, but tests need it to be set | ||||||||||||||||||||||||||||
| 20 | $CPAN::FrontEnd ||= "CPAN::Shell"; | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub new { | ||||||||||||||||||||||||||||
| 23 | 2 | ▶ | my ($class, $cpan_meta) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 2 | my $cpan_sqlite = CPAN::SQLite->new(); | |||||||||||||||||||||||||||
| 25 | 2 | return bless { cpan_meta => $cpan_meta, cpan_sqlite => $cpan_sqlite }, $class; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | sub set { | ||||||||||||||||||||||||||||
| 29 | 352 | ▶ | my ($self, $class, $id) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | 352 | my $sqlite_obj = $self->make_obj(class => $class, id => $id); | |||||||||||||||||||||||||||
| 31 | 352 | return $sqlite_obj->set_one(); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub search { | ||||||||||||||||||||||||||||
| 35 | 8 | ▶ | my ($self, $class, $regex) = @_; | ||||||||||||||||||||||||||
|
Subroutine
search: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 8 | my $sqlite_obj = $self->make_obj(class => $class, regex => $regex); | |||||||||||||||||||||||||||
| 37 | 8 | return $sqlite_obj->set_many(); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub make_obj { | ||||||||||||||||||||||||||||
| 41 | 360 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_obj: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | 360 | my $class = $args{class}; | |||||||||||||||||||||||||||
| 43 | 360 | ▶ | die qq{Must supply a CPAN::* class string} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class and $class =~ /^CPAN::/
MC/DC0%0/2
$class and $class =~ /^CPAN::/
$class
$class =~ /^CPAN::/
Truth table33%1/3
A and B
A= $classB= $class =~ /^CPAN::/
| |||||||||||||||||||||||||||||
| 44 | unless ($class and $class =~ /^CPAN::/); | ||||||||||||||||||||||||||||
| 45 | 360 | (my $type = $class) =~ s/^CPAN//; | |||||||||||||||||||||||||||
| 46 | 360 | my $package = __PACKAGE__ . $type; | |||||||||||||||||||||||||||
| 47 | return bless { | ||||||||||||||||||||||||||||
| 48 | cpan_meta => $self->{cpan_meta}, | ||||||||||||||||||||||||||||
| 49 | cpan_sqlite => $self->{cpan_sqlite}, | ||||||||||||||||||||||||||||
| 50 | class => $class, | ||||||||||||||||||||||||||||
| 51 | id => $args{id}, | ||||||||||||||||||||||||||||
| 52 | regex => $args{regex}, | ||||||||||||||||||||||||||||
| 53 | 360 | }, $package; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | package CPAN::SQLite::META::Author; | ||||||||||||||||||||||||||||
| 57 | 5 | ▶ | use parent 'CPAN::SQLite::META'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 58 | 5 | ▶ | use CPAN::SQLite::Util qw(has_hash_data); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub set_one { | ||||||||||||||||||||||||||||
| 61 | 346 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_one: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | 346 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 63 | 346 | my $id = $self->{id}; | |||||||||||||||||||||||||||
| 64 | 346 | my $class = $self->{class}; | |||||||||||||||||||||||||||
| 65 | 346 | $cpan_sqlite->{results} = {}; | |||||||||||||||||||||||||||
| 66 | 346 | $cpan_sqlite->query(mode => 'author', name => $id, meta_obj => $self); | |||||||||||||||||||||||||||
| 67 | 346 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 68 | 346 | return $cpan_meta->{readonly}{$class}{$id}; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | sub set_many { | ||||||||||||||||||||||||||||
| 72 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_many: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 73 | 2 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 74 | 2 | my $regex = $self->{regex}; | |||||||||||||||||||||||||||
| 75 | 2 | $cpan_sqlite->{results} = []; | |||||||||||||||||||||||||||
| 76 | 2 | return $cpan_sqlite->query(mode => 'author', query => $regex, meta_obj => $self); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | sub set_data { | ||||||||||||||||||||||||||||
| 80 | 5201 | ▶ | my ($self, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | 5201 | return $self->set_author($results->{cpanid}, $results); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | package CPAN::SQLite::META::Distribution; | ||||||||||||||||||||||||||||
| 85 | 5 | ▶ | use parent 'CPAN::SQLite::META'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 86 | 5 | ▶ | use CPAN::SQLite::Util qw(has_hash_data download); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 87 | 5 | ▶ | use CPAN::DistnameInfo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | my $ext = qr{\.(tar\.gz|tar\.Z|tgz|zip)$}; | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub set_one { | ||||||||||||||||||||||||||||
| 91 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_one: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||
| 92 | 4 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 93 | 4 | my $id = $self->{id}; | |||||||||||||||||||||||||||
| 94 | 4 | my ($dist_name, $dist_id); | |||||||||||||||||||||||||||
| 95 | 4 | ▶ | if ($id =~ /$ext/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 4 | ($dist_name, $dist_id) = $self->extract_distinfo($id); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 4 | ▶ | return unless ($dist_name and $dist_id); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dist_name and $dist_id
MC/DC0%0/2
$dist_name and $dist_id
$dist_name
$dist_id
Truth table33%1/3
A and B
A= $dist_nameB= $dist_id
| |||||||||||||||||||||||||||||
| 99 | 4 | my $class = $self->{class}; | |||||||||||||||||||||||||||
| 100 | 4 | $cpan_sqlite->{results} = {}; | |||||||||||||||||||||||||||
| 101 | 4 | $cpan_sqlite->query(mode => 'dist', name => $dist_name, meta_obj => $self); | |||||||||||||||||||||||||||
| 102 | 4 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 103 | 4 | return $cpan_meta->{readonly}{$class}{$dist_id}; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub set_many { | ||||||||||||||||||||||||||||
| 107 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_many: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 108 | 2 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 109 | 2 | my $regex = $self->{regex}; | |||||||||||||||||||||||||||
| 110 | 2 | $cpan_sqlite->{results} = []; | |||||||||||||||||||||||||||
| 111 | 2 | return $cpan_sqlite->query(mode => 'dist', query => $regex, meta_obj => $self); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub set_data { | ||||||||||||||||||||||||||||
| 115 | 602 | ▶ | my ($self, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 116 | 602 | $global_id = $results->{download}; | |||||||||||||||||||||||||||
| 117 | 602 | return $self->set_dist($results->{download}, $results); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | sub set_list_data { | ||||||||||||||||||||||||||||
| 121 | 602 | ▶ | my ($self, $results, $download) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_list_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 122 | 602 | $global_id = $download; | |||||||||||||||||||||||||||
| 123 | 602 | $self->set_containsmods($results); | |||||||||||||||||||||||||||
| 124 | 602 | $global_id = undef; | |||||||||||||||||||||||||||
| 125 | 602 | return; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | package CPAN::SQLite::META::Module; | ||||||||||||||||||||||||||||
| 129 | 5 | ▶ | use parent 'CPAN::SQLite::META'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 130 | 5 | ▶ | use CPAN::SQLite::Util qw(has_hash_data); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | sub set_one { | ||||||||||||||||||||||||||||
| 133 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_one: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 134 | 2 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 135 | 2 | my $id = $self->{id}; | |||||||||||||||||||||||||||
| 136 | 2 | ▶ | return if ($id =~ /^Bundle::/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 2 | my $class = $self->{class}; | |||||||||||||||||||||||||||
| 138 | 2 | $cpan_sqlite->{results} = {}; | |||||||||||||||||||||||||||
| 139 | 2 | $cpan_sqlite->query(mode => 'module', name => $id, meta_obj => $self); | |||||||||||||||||||||||||||
| 140 | 2 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 141 | 2 | return $cpan_meta->{readonly}{$class}{$id}; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub set_many { | ||||||||||||||||||||||||||||
| 145 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_many: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 146 | 2 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 147 | 2 | my $regex = $self->{regex}; | |||||||||||||||||||||||||||
| 148 | 2 | $cpan_sqlite->{results} = []; | |||||||||||||||||||||||||||
| 149 | 2 | return $cpan_sqlite->query(mode => 'module', query => $regex, meta_obj => $self); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | sub set_data { | ||||||||||||||||||||||||||||
| 153 | 13393 | ▶ | my ($self, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 154 | 13393 | $self->set_module($results->{mod_name}, $results); | |||||||||||||||||||||||||||
| 155 | 13393 | $global_id = $results->{download}; | |||||||||||||||||||||||||||
| 156 | 13393 | return $self->set_dist($results->{download}, $results); | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | sub set_list_data { | ||||||||||||||||||||||||||||
| 160 | 2050 | ▶ | my ($self, $results, $download) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_list_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 161 | 2050 | $global_id = $download; | |||||||||||||||||||||||||||
| 162 | 2050 | $self->set_containsmods($results); | |||||||||||||||||||||||||||
| 163 | 2050 | $global_id = undef; | |||||||||||||||||||||||||||
| 164 | 2050 | return; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | package CPAN::SQLite::META::Bundle; | ||||||||||||||||||||||||||||
| 168 | 5 | ▶ | use parent 'CPAN::SQLite::META'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 169 | 5 | ▶ | use CPAN::SQLite::Util qw(has_hash_data); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | sub set_one { | ||||||||||||||||||||||||||||
| 172 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_one: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 173 | 0 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 174 | 0 | my $id = $self->{id}; | |||||||||||||||||||||||||||
| 175 | 0 | ▶ | unless ($id =~ /^Bundle::/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 0 | $id = 'Bundle::' . $id; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | 0 | my $class = $self->{class}; | |||||||||||||||||||||||||||
| 179 | 0 | $cpan_sqlite->{results} = {}; | |||||||||||||||||||||||||||
| 180 | 0 | $cpan_sqlite->query(mode => 'module', name => $id, meta_obj => $self); | |||||||||||||||||||||||||||
| 181 | 0 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 182 | 0 | return $cpan_meta->{readonly}{$class}{$id}; | |||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | sub set_many { | ||||||||||||||||||||||||||||
| 186 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_many: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 187 | 2 | my $cpan_sqlite = $self->{cpan_sqlite}; | |||||||||||||||||||||||||||
| 188 | 2 | my $regex = $self->{regex}; | |||||||||||||||||||||||||||
| 189 | 2 | ▶ | unless ($regex =~ /(^Bundle::|[\^\$\*\+\?\|])/i) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 2 | $regex = '^Bundle::' . $regex; | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | 2 | ▶ | $regex = '^Bundle::' if $regex eq '^'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 2 | $cpan_sqlite->{results} = []; | |||||||||||||||||||||||||||
| 194 | 2 | return $cpan_sqlite->query(mode => 'module', query => $regex, meta_obj => $self); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub set_data { | ||||||||||||||||||||||||||||
| 198 | 8 | ▶ | my ($self, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 199 | 8 | $self->set_bundle($results->{mod_name}, $results); | |||||||||||||||||||||||||||
| 200 | 8 | $global_id = $results->{download}; | |||||||||||||||||||||||||||
| 201 | 8 | return $self->set_dist($results->{download}, $results); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | sub set_list_data { | ||||||||||||||||||||||||||||
| 205 | 7 | ▶ | my ($self, $results, $download) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_list_data: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 206 | 7 | $global_id = $download; | |||||||||||||||||||||||||||
| 207 | 7 | $self->set_containsmods($results); | |||||||||||||||||||||||||||
| 208 | 7 | $global_id = undef; | |||||||||||||||||||||||||||
| 209 | 7 | return; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | package CPAN::SQLite::META; | ||||||||||||||||||||||||||||
| 213 | 5 | ▶ | use CPAN::SQLite::Util qw(download); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); | ||||||||||||||||||||||||||||
| 216 | my @days = qw(Sun Mon Tue Wed Thu Fri Sat); | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | sub set_author { | ||||||||||||||||||||||||||||
| 219 | 5201 | ▶ | my ($self, $id, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_author: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 220 | 5201 | my $class = 'CPAN::Author'; | |||||||||||||||||||||||||||
| 221 | 5201 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 222 | return $cpan_meta->instance($class => $id)->set( | ||||||||||||||||||||||||||||
| 223 | 'FULLNAME' => $results->{fullname}, | ||||||||||||||||||||||||||||
| 224 | 'EMAIL' => $results->{email}, | ||||||||||||||||||||||||||||
| 225 | 5201 | ); | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | sub set_module { | ||||||||||||||||||||||||||||
| 229 | 13393 | ▶ | my ($self, $id, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_module: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 230 | 13393 | my $class = 'CPAN::Module'; | |||||||||||||||||||||||||||
| 231 | 13393 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 232 | 13393 | my $d = $cpan_meta->instance($class => $id); | |||||||||||||||||||||||||||
| 233 | return $d->set( | ||||||||||||||||||||||||||||
| 234 | 'description' => $results->{mod_abs}, | ||||||||||||||||||||||||||||
| 235 | 'userid' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 236 | 'CPAN_VERSION' => $results->{mod_vers}, | ||||||||||||||||||||||||||||
| 237 | 'CPAN_FILE' => $results->{download}, | ||||||||||||||||||||||||||||
| 238 | 'CPAN_USERID' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 239 | 13393 | ); | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | sub set_bundle { | ||||||||||||||||||||||||||||
| 243 | 8 | ▶ | my ($self, $id, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_bundle: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 244 | 8 | my $class = 'CPAN::Bundle'; | |||||||||||||||||||||||||||
| 245 | 8 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 246 | 8 | my $d = $cpan_meta->instance($class => $id); | |||||||||||||||||||||||||||
| 247 | return $d->set( | ||||||||||||||||||||||||||||
| 248 | 'description' => $results->{mod_abs}, | ||||||||||||||||||||||||||||
| 249 | 'userid' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 250 | 'CPAN_VERSION' => $results->{mod_vers}, | ||||||||||||||||||||||||||||
| 251 | 'CPAN_FILE' => $results->{download}, | ||||||||||||||||||||||||||||
| 252 | 'CPAN_USERID' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 253 | 8 | ); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | sub set_dist { | ||||||||||||||||||||||||||||
| 257 | 14003 | ▶ | my ($self, $id, $results) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_dist: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 258 | 14003 | my $class = 'CPAN::Distribution'; | |||||||||||||||||||||||||||
| 259 | 14003 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 260 | 14003 | my $d = $cpan_meta->instance($class => $id); | |||||||||||||||||||||||||||
| 261 | return $d->set( | ||||||||||||||||||||||||||||
| 262 | 'DESCRIPTION' => $results->{dist_abs}, | ||||||||||||||||||||||||||||
| 263 | 'CPAN_USERID' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 264 | 'CPAN_VERSION' => $results->{dist_vers}, | ||||||||||||||||||||||||||||
| 265 | 14003 | ); | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | sub set_containsmods { | ||||||||||||||||||||||||||||
| 269 | 2659 | ▶ | my ($self, $mods) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_containsmods: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 270 | 2659 | my $class = 'CPAN::Distribution'; | |||||||||||||||||||||||||||
| 271 | 2659 | my $cpan_meta = $self->{cpan_meta}; | |||||||||||||||||||||||||||
| 272 | 2659 | my %containsmods; | |||||||||||||||||||||||||||
| 273 | 2659 | ▶ | if ($mods and (ref($mods) eq 'ARRAY')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mods and ref $mods eq "ARRAY"
MC/DC0%0/2
$mods and ref $mods eq "ARRAY"
$mods
ref $mods eq "ARRAY"
Truth table33%1/3
A and B
A= $modsB= ref $mods eq "ARRAY"
| |||||||||||||||||||||||||||||
| 274 | 2659 | %containsmods = map { $_->{mod_name} => 1 } @$mods; | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | 2659 | my $d = $cpan_meta->instance($class => $global_id); | |||||||||||||||||||||||||||
| 277 | 2659 | return $d->{CONTAINSMODS} = \%containsmods; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | sub reload { | ||||||||||||||||||||||||||||
| 281 | 2 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
reload: called CC=11 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 2 | ▶ | my $time = $args{'time'} || time; | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{'time'} || time
MC/DC0%0/2
$args{'time'} || time
$args{'time'}
time
Truth table33%1/3
A || B
A= $args{'time'}B= time
| |||||||||||||||||||||||||||||
| 284 | 2 | my $force = $args{force}; | |||||||||||||||||||||||||||
| 285 | 2 | my $db_name = $CPAN::SQLite::db_name; | |||||||||||||||||||||||||||
| 286 | 2 | my $db = File::Spec->catfile($CPAN::Config->{cpan_home}, $db_name); | |||||||||||||||||||||||||||
| 287 | 2 | my $journal_file = $db . '-journal'; | |||||||||||||||||||||||||||
| 288 | 2 | ▶ | if (-e $journal_file) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 0 | $CPAN::FrontEnd->mywarn('Database locked - cannot update.'); | |||||||||||||||||||||||||||
| 290 | 0 | return; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | 2 | my @args = ($^X, '-MCPAN::SQLite::META=setup,update,check', '-e'); | |||||||||||||||||||||||||||
| 293 | 2 | ▶ | if (-e $db && -s _) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-e $db and -s _
MC/DC50%1/2
-e $db and -s _
-e $db
-s _
Truth table66%2/3
A and B
A= -e $dbB= -s _
| |||||||||||||||||||||||||||||
| 294 | 1 | my $mtime_db = (stat(_))[9]; | |||||||||||||||||||||||||||
| 295 | 1 | my $time_string = gmtime_string($mtime_db); | |||||||||||||||||||||||||||
| 296 | 1 | $CPAN::FrontEnd->myprint("Database was generated on $time_string\n"); | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | # Check for status, force update if it fails | ||||||||||||||||||||||||||||
| 299 | 1 | ▶ | if (system(@args, 'check')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 300 | 0 | $force = 1; | |||||||||||||||||||||||||||
| 301 | 0 | $CPAN::FrontEnd->myprint("Database file requires reindexing\n"); | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 1 | ▶ | unless ($force) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 1 | ▶ | return if (($time - $mtime_db) < $CPAN::Config->{index_expire} * 86400); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | 0 | $CPAN::FrontEnd->myprint('Updating database file ... '); | |||||||||||||||||||||||||||
| 308 | 0 | push @args, q{update}; | |||||||||||||||||||||||||||
| 309 | } else { | ||||||||||||||||||||||||||||
| 310 | 1 | ▶ | unlink($db) if -e _; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 311 | 1 | $CPAN::FrontEnd->myprint('Creating database file ... '); | |||||||||||||||||||||||||||
| 312 | 1 | push @args, q{setup}; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | 1 | ▶ | if ($CPAN::SQLite::DBI::dbh) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | $CPAN::SQLite::DBI::dbh->disconnect(); | |||||||||||||||||||||||||||
| 316 | 0 | $CPAN::SQLite::DBI::dbh = undef; | |||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | 1 | ▶ | system(@args) == 0 or die qq{system @args failed: $?}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 319 | 1 | $CPAN::FrontEnd->myprint("Done!\n"); | |||||||||||||||||||||||||||
| 320 | 1 | return 1; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | sub setup { | ||||||||||||||||||||||||||||
| 324 | 0 | ▶ | my $obj = CPAN::SQLite->new(setup => 1); | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 325 | 0 | ▶ | $obj->index() or die qq{CPAN::SQLite setup failed}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | 0 | return; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | sub update { | ||||||||||||||||||||||||||||
| 330 | 0 | ▶ | my $obj = CPAN::SQLite->new(); | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 331 | 0 | ▶ | $obj->index() or die qq{CPAN::SQLite update failed}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | 0 | return; | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | sub check { | ||||||||||||||||||||||||||||
| 336 | 0 | ▶ | my $obj = CPAN::SQLite->new(); | ||||||||||||||||||||||||||
|
Subroutine
check: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 337 | 0 | my $db = File::Spec->catfile($obj->{'db_dir'}, $obj->{'db_name'}); | |||||||||||||||||||||||||||
| 338 | 0 | my $dbh = DBI->connect("DBI:SQLite:$db", '', '', { 'RaiseError' => 0, 'PrintError' => 0, 'AutoCommit' => 1 }); | |||||||||||||||||||||||||||
| 339 | 0 | ▶ | if (my $sth = $dbh->prepare('SELECT status FROM info WHERE status = 1')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if ($sth->execute()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ($sth->fetchrow_arrayref()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 0 | exit 0; # status = 1 | |||||||||||||||||||||||||||
| 343 | } else { | ||||||||||||||||||||||||||||
| 344 | 0 | exit 1; # status <> 1, need reindexing | |||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | } else { | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | # Something's wrong, will be safer to reinitialize | ||||||||||||||||||||||||||||
| 349 | 0 | $dbh->disconnect(); | |||||||||||||||||||||||||||
| 350 | 0 | undef $dbh; | |||||||||||||||||||||||||||
| 351 | 0 | setup(); | |||||||||||||||||||||||||||
| 352 | 0 | update(); | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | } else { | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | # Probably old version of DB or no DB at all, run setup and update | ||||||||||||||||||||||||||||
| 357 | 0 | $dbh->disconnect(); | |||||||||||||||||||||||||||
| 358 | 0 | undef $dbh; | |||||||||||||||||||||||||||
| 359 | 0 | setup(); | |||||||||||||||||||||||||||
| 360 | 0 | update(); | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | 0 | return; | |||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | sub gmtime_string { | ||||||||||||||||||||||||||||
| 366 | 1 | ▶ | my $time = shift; | ||||||||||||||||||||||||||
|
Subroutine
gmtime_string: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 367 | 1 | ▶ | return unless $time; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 368 | 1 | my @a = gmtime($time); | |||||||||||||||||||||||||||
| 369 | 1 | my $string = | |||||||||||||||||||||||||||
| 370 | sprintf("%s, %02d %s %d %02d:%02d:%02d GMT", $days[$a[6]], $a[3], $months[$a[4]], $a[5] + 1900, $a[2], $a[1], $a[0]); | ||||||||||||||||||||||||||||
| 371 | 1 | return $string; | |||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | sub extract_distinfo { | ||||||||||||||||||||||||||||
| 375 | 4 | ▶ | my ($self, $pathname) = @_; | ||||||||||||||||||||||||||
|
Subroutine
extract_distinfo: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 376 | 4 | ▶ | unless ($pathname =~ m{^\w/\w\w/}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 377 | 2 | $pathname =~ s{^(\w)(\w)(.*)}{$1/$1$2/$1$2$3}; | |||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||
| 379 | 4 | my $d = CPAN::DistnameInfo->new($pathname); | |||||||||||||||||||||||||||
| 380 | 4 | my $dist = $d->dist; | |||||||||||||||||||||||||||
| 381 | 4 | my $download = download($d->cpanid, $d->filename); | |||||||||||||||||||||||||||
| 382 | 4 | ▶ | return ($dist and $download) ? ($dist, $download) : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dist and $download
MC/DC0%0/2
$dist and $download
$dist
$download
Truth table33%1/3
A and B
A= $distB= $download
| |||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | 1; | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | =head1 NAME | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | CPAN::SQLite::META - helper module for CPAN.pm integration | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | =head1 VERSION | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | version 0.219 | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | This module has no direct public interface, but is intended | ||||||||||||||||||||||||||||
| 398 | as a helper module for use of CPAN::SQLite within the CPAN.pm | ||||||||||||||||||||||||||||
| 399 | module. A new object is created as | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | my $obj = CPAN::SQLite::META->new($CPAN::META); | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | where C<$CPAN::META> comes from CPAN.pm. There are then | ||||||||||||||||||||||||||||
| 404 | two main methods available. | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =over 4 | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | =item C<set> | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | This is used as | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | $obj->set($class, $id); | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | where C<$class> is one of C<CPAN::Author>, C<CPAN::Module>, or | ||||||||||||||||||||||||||||
| 415 | C<CPAN::Distribution>, and C<$id> is the id CPAN.pm uses to | ||||||||||||||||||||||||||||
| 416 | identify the class. The method searches the C<CPAN::SQLite> | ||||||||||||||||||||||||||||
| 417 | database by name using the appropriate C<author>, C<dist>, | ||||||||||||||||||||||||||||
| 418 | or C<module> mode, and if a result is found, calls | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | $CPAN::META->instance( | ||||||||||||||||||||||||||||
| 421 | $class => $id | ||||||||||||||||||||||||||||
| 422 | )->set( | ||||||||||||||||||||||||||||
| 423 | %attributes | ||||||||||||||||||||||||||||
| 424 | ); | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | to register an instance of this class within C<CPAN.pm>. | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | =item C<ssearch> | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | This is used as | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | $obj->search($class, $id); | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | where C<$class> is one of C<CPAN::Author>, C<CPAN::Module>, or | ||||||||||||||||||||||||||||
| 435 | C<CPAN::Distribution>, and C<$id> is the id CPAN.pm uses to | ||||||||||||||||||||||||||||
| 436 | identify the class. The method searches the C<CPAN::SQLite> | ||||||||||||||||||||||||||||
| 437 | database by C<query> using the appropriate C<author>, C<dist>, | ||||||||||||||||||||||||||||
| 438 | or C<module> mode, and if results are found, calls | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | $CPAN::META->instance( | ||||||||||||||||||||||||||||
| 441 | $class => $id | ||||||||||||||||||||||||||||
| 442 | )->set( | ||||||||||||||||||||||||||||
| 443 | %attributes | ||||||||||||||||||||||||||||
| 444 | ); | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | for each match to register an instance of this class | ||||||||||||||||||||||||||||
| 447 | within C<CPAN.pm>. | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | =back | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | The attributes set within C<$CPAN::META->instance> depend | ||||||||||||||||||||||||||||
| 452 | on the particular class. | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =over | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | =item author | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | The attributes are | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 'FULLNAME' => $results->{fullname}, | ||||||||||||||||||||||||||||
| 461 | 'EMAIL' => $results->{email}, | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | where C<$results> are the results returned from C<CPAN::SQLite>. | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | =item module | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | The attributes are | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | 'description' => $results->{mod_abs}, | ||||||||||||||||||||||||||||
| 470 | 'userid' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 471 | 'CPAN_VERSION' => $results->{mod_vers}, | ||||||||||||||||||||||||||||
| 472 | 'CPAN_FILE' => $results->{download}, | ||||||||||||||||||||||||||||
| 473 | 'CPAN_USERID' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | where C<$results> are the results returned from C<CPAN::SQLite>. | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =item dist | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | The attributes are | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | 'DESCRIPTION' => $results->{dist_abs}, | ||||||||||||||||||||||||||||
| 482 | 'CPAN_USERID' => $results->{cpanid}, | ||||||||||||||||||||||||||||
| 483 | 'CPAN_VERSION' => $results->{dist_vers}, | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | As well, a C<CONTAINSMODS> key to C<$CPAN::META> is added, this | ||||||||||||||||||||||||||||
| 486 | being a hash reference whose keys are the modules contained | ||||||||||||||||||||||||||||
| 487 | within the distribution. | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | =back | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | There is also a method available C<reload>, which rebuilds | ||||||||||||||||||||||||||||
| 492 | the database. It can be used as | ||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | $obj->reload(force => 1, time => $time); | ||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | The C<time> option (which, if not passed in, will default to the | ||||||||||||||||||||||||||||
| 497 | current time) will be used to compare the current time to | ||||||||||||||||||||||||||||
| 498 | the mtime of the database file; if they differ by more than | ||||||||||||||||||||||||||||
| 499 | one day, the database will be rebuilt. The <force> option, if | ||||||||||||||||||||||||||||
| 500 | given, will force a rebuilding of the database regardless | ||||||||||||||||||||||||||||
| 501 | of the time difference. | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | =cut | ||||||||||||||||||||||||||||