So you’ve got this great new local CPAN you can use to install stuff you know about but how do you find stuff you don’t know about? There are two main ways I inspect the contents of my local CPAN mirror. The first is a simple shell function for searching package names, the second, has a bit more to it but we will save that for later.
grep to the Rescue
One of the metadata files in our local mirror is
/modules/02packages.details.txt.gz. Let’s take a look inside.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The format is pretty straightforward. After a few header lines, we have one
line per package seen by the indexer. The lines consist of three whitespace
separated columns of a package name, current package version (if the indexer found one),
and latest distribution containing it. The AAC-Provoice and Apache-FastForward
distributions show us that each individual package within the distribution is
listed. We could easily use
zgrep to find packages that match a pattern.
1 2 3 4 5
This is a little long to type regularly. A shell alias isn’t appropriate as we want to sandwich the provided input between zgrep and the path to the file. Fortunately, a shell function will allow us to do this without much more verbosity.
1 2 3
Dropping this line in your
.bashrc will allow you to search
02packages.details.txt.gz with the
1 2 3 4 5 6 7 8
Since we use
$* instead of
$1, all arguments we give to the function are
passed on to zgrep. This allows us to do things like search with or without
ignoring case on demand.
CPAN::Mini::Webserver provides a
script that launches a web server providing an interface to your local minicpan.
Usage couldn’t be easier, install
CPAN::Mini::Webserver then run
minicpan_webserver. By default the server binds to port 2963 but you can
change this with the
If you’ve used search.cpan.org or
metacpan, there should be no surprises in how to navigate
around the site. The
documentation has information on
a few things you can plug in to your
.minicpanrc to enable things like full
Here are a few screenshots of CPAN::Mini::Webserver to wet your appetite.