CPAN::SQLite::META - helper module for CPAN.pm integration
This module has no direct public interface, but is intended as a helper module for use of CPAN::SQLite within the CPAN.pm module. A new object is created as
my $obj = CPAN::SQLite::META->new($CPAN::META);
where $CPAN::META comes from CPAN.pm. There are then two main methods available.
$CPAN::META
set
This is used as
$obj->set($class, $id);
where $class is one of CPAN::Author, CPAN::Module, or CPAN::Distribution, and $id is the id CPAN.pm uses to identify the class. The method searches the CPAN::SQLite database by name using the appropriate author, dist, or module mode, and if a result is found, calls
$class
CPAN::Author
CPAN::Module
CPAN::Distribution
$id
CPAN::SQLite
author
dist
module
$CPAN::META->instance( $class => $id )->set( %attributes );
to register an instance of this class within CPAN.pm.
CPAN.pm
ssearch
$obj->search($class, $id);
where $class is one of CPAN::Author, CPAN::Module, or CPAN::Distribution, and $id is the id CPAN.pm uses to identify the class. The method searches the CPAN::SQLite database by query using the appropriate author, dist, or module mode, and if results are found, calls
query
for each match to register an instance of this class within CPAN.pm.
The attributes set within $CPAN::META-instance> depend on the particular class.
$CPAN::META-
The attributes are
'FULLNAME' => $results->{fullname}, 'EMAIL' => $results->{email},
where $results are the results returned from CPAN::SQLite.
$results
'description' => $results->{mod_abs}, 'userid' => $results->{cpanid}, 'CPAN_VERSION' => $results->{mod_vers}, 'CPAN_FILE' => $results->{download}, 'CPAN_USERID' => $results->{cpanid}, 'chapterid' => $results->{chapterid}, %dslip,
where $results are the results returned from CPAN::SQLite. Here, %dslip is a hash containing keys statd, stats, statl, stati, and statp, with corresponding values being the registered dslip entries for the module, if present.
%dslip
statd
stats
statl
stati
statp
'DESCRIPTION' => $results->{dist_abs}, 'CPAN_USERID' => $results->{cpanid}, 'CPAN_VERSION' => $results->{dist_vers},
As well, a CONTAINSMODS key to $CPAN::META is added, this being a hash reference whose keys are the modules contained within the distribution.
CONTAINSMODS
There is also a method available reload, which rebuilds the database. It can be used as
reload
$obj->reload(force => 1, time => $time);
The time option (which, if not passed in, will default to the current time) will be used to compare the current time to the mtime of the database file; if they differ by more than one day, the database will be rebuilt. The <force> option, if given, will force a rebuilding of the database regardless of the time difference.
time
To install CPAN::SQLite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPAN::SQLite
CPAN shell
perl -MCPAN -e shell install CPAN::SQLite
For more information on module installation, please visit the detailed CPAN module installation guide.