NAME
CPAN::SQLite::META - helper module for CPAN.pm integration
DESCRIPTION
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.
set
-
This is used as
$obj->set($class, $id);
where
$class
is one ofCPAN::Author
,CPAN::Module
, orCPAN::Distribution
, and$id
is the id CPAN.pm uses to identify the class. The method searches theCPAN::SQLite
database by name using the appropriateauthor
,dist
, ormodule
mode, and if a result is found, calls$CPAN::META->instance( $class => $id )->set( %attributes );
to register an instance of this class within
CPAN.pm
. ssearch
-
This is used as
$obj->search($class, $id);
where
$class
is one ofCPAN::Author
,CPAN::Module
, orCPAN::Distribution
, and$id
is the id CPAN.pm uses to identify the class. The method searches theCPAN::SQLite
database byquery
using the appropriateauthor
,dist
, ormodule
mode, and if results are found, calls$CPAN::META->instance( $class => $id )->set( %attributes );
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.
-
The attributes are
'FULLNAME' => $results->{fullname}, 'EMAIL' => $results->{email},
where
$results
are the results returned fromCPAN::SQLite
. - module
-
The attributes are
'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 fromCPAN::SQLite
. Here,%dslip
is a hash containing keysstatd
,stats
,statl
,stati
, andstatp
, with corresponding values being the registered dslip entries for the module, if present. - dist
-
The attributes are
'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.
There is also a method available reload
, which rebuilds the database. It can be used as
$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.