CPANDB::Generator - Generator module for the CPAN Index Database


  # Simplicity itself


This is a module used to generate a unified index database, pulling in data from various other sources to produce a single schema that contains the essential elements from all of them.

It is uploaded to the CPAN for the purpose of full disclosure, or in case the author gets hit by a bus. Generating the index database involves downloading a number of relatively large SQLite datasets, the consumption of several gigabytes of disk, and a fairly large amount of CPU time.

If you are interested in using the index database, you should instead see the CPANDB distribution.



  my $cpan = CPANDB::Generator->new(
      cpan   => '/root/.cpan',
      sqlite => '/root/CPANDB.sqlite',

Creates a new generation object.

The optional cpan param identifies the path to your cpan operating directory. By default, a fresh one will be generated in a temporary directory, and deleted at the end of the generation run.

The optional sqlite param specifies where the SQLite database should be written to. By default, this will be to a standard location in your home directory.

Returns a new CPANDB::Generator object.


The dir method returns the directory that the SQLite database will be written into.


The dsn method returns the DBI DSN that is used to connect to the generated database.


Once it has been fetched or updated from your CPAN mirror, the cpan_sql method returns the location of the CPAN::SQLite database used by the CPAN client.

This database is used as the source of the information that forms the core of the unified index database, and that the rest of the data will be decorated around.


The run method executes the process that will produce and fill the final database.


Bugs should be reported via the CPAN bug tracker at

For other issues, contact the author.


Adam Kennedy <>


Copyright 2009 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.