releasing to [remote] minicpan (preferably with Dist::Zilla)

Traditionally at $work we do a git clone of our various repos and run the projects straight from the working directory, but lately I've been moving towards the good habit of packaging small related components into their own dists ("I \N{HEAVY BLACK HEART} Dist::Zilla"), so the desire for a real company darkpan has been increasing.

I have a combination minicpan/darkpan that (mostly) works right now using:

One advantage of using CPAN::Mini::Inject::Server is that you can run it as a designated user and anybody who has access to the server can post to it.

I got it running with this app.psgi:

use CGI::Application::Emulate::PSGI;
use CPAN::Mini::Inject::Server::Dispatch;

CGI::Application::Emulate::PSGI->handler(sub {
  CPAN::Mini::Inject::Server::Dispatch->dispatch();
});

I tried CGI::Application::PSGI and CGI::Application::Dispatch::PSGI but wasn't able to get either of them working right (according to their synopses). Third time's a charm. Thanks, CGI::Application::Emulate::PSGI.

So I added the Inject plugin to my $work Dist::Zilla bundle, set remote_server to "http://localhost:7990/" (arbitrary port) and set a fake author_id.

I telecommute, so I spend most of my work day with an open ssh connection to the office, so adding another port-forward to my present list was no trouble. Obviously, your authentication method will be up to you.

If you don't use Dist::Zilla, CPAN::Mini::Inject::Remote has a command line script (and an API) that you should be able to leverage for your situation.

the issue (if you don't update)

The only problem I have with this setup is an outstanding issue with CPAN::Mini::Inject: injecting newer versions of your modules doesn't remove older versions from the list, so cpanminus will find the first (oldest) version in the 02packages file and use that one. The workaround is to update your minicpan mirror and then re-inject (you don't have to re-add).

UPDATE (fixed)

CPAN::Mini::Inject 0.30 was released this morning which fixes the aforementioned issue. Thanks go to Christian Walde and Paul Driver. Hooray!

a new breed

I'm very interested to see if chromatic's new Darkpan module will be a more interesting or practical solution in this or other scenarios. It may prove easier to keep 2 different PANs (one mini, one dark) up to date separately, and just add an extra --mirror argument to cpanm. I'll have to play with that this week and I'll try to pass along any feedback.

A big thanks to all the authors of all the modules that work together to make this happen. CPAN really is the happiest place on earth.

5 Comments

I just uploaded version 0.30 of CMI to PAUSE, which should fix your issue. :) ( http://beta.metacpan.org/release/CPAN-Mini-Inject )

Thanks for taking the time to write about and highlight this, since i'd completely missed the laundry list of stuff on Andy's github.

I've setup the same kind of system, and it all works just as you've described. But there seems to be a major limitation: it only allows you to inject one module per distribution.



Most non-trivial distributions will contain several modules. The mcpani[1] command has the --all-in-meta and --discover-packages options which allow you to inject tar.gz files that contain several modules. But those features don't seem to be present in C::M::I::Remote and C::M::I::Server modules.



Is my assessment accurate? Or have I just not figured out how to use these tools correctly?

Leave a comment

About Randy Stauner

user-pic perl -C -E 'say"i \x{2764} ",($^X =~ m#([^/]+)$#)'