This weekend I worked on
a new CPAN distribution, and yesterday released version 0.0.1 of it to the
CPAN. In a nutshell, Module-Format allows one to convert strings representing
Perl modules (and their encapsulating distributions) to representation-netural
objects, and to render them into other formats of modules. To better
explain the motivation, let's start with a few use cases for this.
If you're working on Debian, Ubuntu or a derivative and would like to install
Perl distributions using apt-get, you can define the following shell function:
apt-get -y install $(perlmf as_deb "$@")
And then inovke it like up XML::RSS XML-LibXML DBIx/Class.pm (note
the inconsistency - perlmf handles all those formats for you), and it
will install them.
Similarly in Mandriva using urpmi you can use:
urpmi --auto $(perlmf as_rpm_colon "$@")
And then type the same command. (It will actually be better because urpmi
will fetch individual rpm provides modules such as perl(XML::RSS)
that may be contained in larger distributions).
Similarly to install stuff using cpan2dist, one can say something like:
cpan2dist --verbose --format=CPANPLUS::Dist::Mdv \
--install --timeout 0 $(perlmf as_colon "$@")
So this is what perlmf, which is the command-line program that ships with
Module-Format can do. Module-Format provides a more generic Perl-based
API for that, and replaces some ugly and ad-hoc shell functions that I defined
Module-Format is: 1. Free and open source software distributed under the
permissive MIT/X11 licence. and 2. Only dependent on core modules and
List::MoreUtils (a dependency which I'm planning to remove in a future
release). The source code is maintained in
the web-cpan Mercurial
repository, so feel free to contribute.
Happy module formatting.