CPAN::Index::Loader - Populates the CPAN index SQLite database
This package implements all the functionality required to download the CPAN index data, parse it, and populate the SQLite database file.
Because it involves loading a number of otherwise unneeded modules, this package is not loaded by default with the rest of CPAN::Index, but may be loaded on-demand if needed.
my $loader = CPAN::Index::Loader->new( remote_uri => 'http://search.cpan.org/CPAN', local_dir => '/tmp/cpanindex', );
The cache accessor returns a CPAN::Cache object that represents the CPAN cache.
cache
The remote_uri accessor return a URI object for the location of the CPAN mirror.
remote_uri
The local_dir accessor returns the filesystem path for the root directory of the local CPAN file cache.
local_dir
my $path = $loader->local_file('01mailrc.txt.gz');
The local_file method takes the name of a file in the CPAN and returns the local path to the file.
local_file
Returns a path string, or throws an exception on error.
my $path = $loader->local_handle('01mailrc.txt.gz');
The local_handle method takes the name of a file in the CPAN and returns an IO::Handle to the file.
local_handle
Returns an IO::Handle, most likely an IO::Handle, or throws an exception on error.
The load_index takes a single param of the schema to load, locates the three main index files based on the local_dir path, and then loads the index from those files.
load_index
Returns the total number of records added.
CPAN::Index::Loader->load_authors( $schema, $handle );
The load_authors method populates the package table from the CPAN 01mailrc.txt.gz file.
load_authors
package
The author table in the SQLite database should already be empty before this method is called.
author
Returns the number of authors added to the database, or throws an exception on error.
CPAN::Index::Loader->load_packages( $schema, $handle );
The load_packages method populates the package table from the CPAN 02packages.details.txt.gz file.
load_packages
The package table in the SQLite database should already be empty before this method is called.
Returns the number of packages added to the database, or throws an exception on error.
Bugs should be reported via the CPAN bug tracker
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPAN-Index
For other issues, contact the author.
Adam Kennedy <cpan@ali.as>
Parts based on various modules by Leon Brocard <acme@cpan.org>
Related: CPAN::Index, CPAN
Based on: Parse::CPAN::Authors, Parse::CPAN::Packages
Copyright (c) 2006 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install CPAN::Index, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPAN::Index
CPAN shell
perl -MCPAN -e shell install CPAN::Index
For more information on module installation, please visit the detailed CPAN module installation guide.