Using lcpan to index your DarkPAN

lcpan is an application to manage your local CPAN (or CPAN-like) repository. It creates a SQLite database from information in your CPAN-like repository so you can query various stuffs about your repository.

DarkPAN is a term to describe a directory hierarchy containing collection of Perl modules that is structured like a CPAN mirror. So, there is an authors/id/ directory structures, modules/02packages.details.txt.gz index file, and so on. It can be created with some tools likeOrePAN or CPAN::Mini::Inject. You can use various CPAN tools on it, like cpanm, cpan-outdated, and so on. The difference with a normal CPAN mirror is that a DarkPAN contains your own modules and can be private. It leverages existing CPAN tools for your private modules.

If you are maintaining your own DarkPAN, the recent versions of lcpan can now also index your DarkPAN too, so you can query various stuffs about your DarkPAN like you would a normal mini CPAN mirror. Previously there was a problem because some DarkPANs like those produced by OrePAN do not contain authors/01mailrc.txt.gz but authors/00whois.xml instead. Recent versions of lcpan resolve this by also looking for 00whois.xml.

To start using lcpan for your DarkPAN, I suggest you put a few lines in your ~/lcpan.conf. Suppose your DarkPAN is in /home/budi/darkpan-budi. In lcpan.conf:

[profile=darkpan-budi subcommand=update]

Now, index your DarkPAN:

% lcpan --config-profile darkpan-budi update

(You will need to do this after you add/remove files from your DarkPAN.)

Next, you can query your DarkPAN:

% lcpan --config-profile darkpan-budi mods -l
% lcpan --config-profile darkpan-budi author-rdeps BUDI --user-author-isnt BUDI

To make it more convenient, you can create a script, e.g. lcpan-budi:

# FRAGMENT id=shcompgen-hint command=lcpan command_args="--config-profile darkpan-budi"
lcpan --config-profile darkpan-budi "$@"

The # FRAGMENT bit is a hint for shcompgen, if you use that application. After you create the above script and put it somewhere in your PATH, you run shcompgen generate so that the lcpan-budi has working tab completion.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s