The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CPAN::Index::Loader - Populates the CPAN index SQLite database

DESCRIPTION

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.

METHODS

new

  my $loader = CPAN::Index::Loader->new(
      remote_uri => 'http://search.cpan.org/CPAN',
      local_dir  => '/tmp/cpanindex',
      );

cache

The cache accessor returns a CPAN::Cache object that represents the CPAN cache.

remote_uri

The remote_uri accessor return a URI object for the location of the CPAN mirror.

local_dir

The local_dir accessor returns the filesystem path for the root directory of the local CPAN file cache.

local_file

  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.

Returns a path string, or throws an exception on error.

local_handle

  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.

Returns an IO::Handle, most likely an IO::Handle, or throws an exception on error.

load_index

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.

Returns the total number of records added.

load_authors

  CPAN::Index::Loader->load_authors( $schema, $handle );

The load_authors method populates the package table from the CPAN 01mailrc.txt.gz file.

The author table in the SQLite database should already be empty before this method is called.

Returns the number of authors added to the database, or throws an exception on error.

load_packages

  CPAN::Index::Loader->load_packages( $schema, $handle );

The load_packages method populates the package table from the CPAN 02packages.details.txt.gz file.

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.

SUPPORT

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.

AUTHOR

Adam Kennedy <cpan@ali.as>

Parts based on various modules by Leon Brocard <acme@cpan.org>

SEE ALSO

Related: CPAN::Index, CPAN

Based on: Parse::CPAN::Authors, Parse::CPAN::Packages

COPYRIGHT

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.