Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

acme
  (email not shown publicly)
http://www.astray.com/

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Thursday August 07, 2008
02:46 AM

CPAN::Mini::Webserver

[ #37117 ]

CPAN is quite large at 4.9GB (BACKPAN, which holds everything ever uploaded to CPAN is even larger, at 11GB). This is why we have CPAN::Mini, which creates a minimal mirror of CPAN ("It contains only those files needed to install the newest version of every distribution") which comes in at a very reasonable 872MB. The first time you run it, it takes a while, but updates run pretty quickly.

search.cpan.org is a pretty useful website for searching CPAN. Unfortunately sometimes I am not online. Sometimes I am online but have very spotty access. You can't run search.cpan.org locally as it is closed-source. I've been annoyed about this in the past, errr, seven years now, but haven't quite figured out the proper solution. Now I have: let me announce to the world CPAN::Mini::Webserver.

You must create a minicpan with CPAN::Mini. Then install the module and simply run minicpan_webserver. This finds out where your minicpan lies, reads some indexes from it, and starts a web server. Through the web interface you can search for authors, distributions and packages, browse distributions by author, browse files in a distribution, see the documentation of any file and see syntax-highlighted Perl code. All while offline. Try it out now!

It works well enough, but I have some more plans. Let's have a BoF about it at YAPC::Europe in Copenhagen. Tell me what you think, Léon.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Excellent! Most excellent! :)

    Do you have a repo somewhere, git or svn, that I can send patches against?

    I would like to fix a couple of nits.

    Much better than the podwebserver I was using...

    Best regards,

    --
    life is short
  • CPAN::Mini globs the local directory name to expand, e.g. ~/my-little-cpan so you need something like this:

    --- lib/CPAN/Mini/Webserver.pm.orig    2008-08-07 13:03:04.000000000 +0100
    +++ lib/CPAN/Mini/Webserver.pm    2008-08-07 13:01:40.000000000 +0100
    @@ -26,7 +26,7 @@
    sub after_setup_listener {
         my $self      = shift;
         my %config    = CPAN::Mini->read_config;
    -    my $directory = dir( $config{local} );
    +   

  • I tried to install this a while ago and it failed. It looks like it is failing for most reporting installers. I tracked down my failure (please set up minicpan) to something that I predict will be common.

    CPAN::Mini expands ~ in its config to CPAN::Mini->__homedir during new, but CMW doesn't. That means it looks for files literally named ~, and fails to find them. With my config updated to use an absolute directory name, it worked.

    Obviously(?) I'd rather use ~, since it lets me share the config on mac

    --
    rjbs
    • I've just released 0.33 which includes:

      - glob the local directory name (like CPAN::Mini does) to make
      ~/my-little-cpan work (patch by Andy Armstrong)

  • That's nice.

    Yes. Let's have a BoF about this. Ideally somewhere you can share commit bits with people ;)