Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)


"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Monday September 30, 2002
12:27 AM

Making CPAN dists

[ #8087 ]
Dear Log,
So I wrote this little dealy today for automating the process of building the dist of a CPAN module. It seems to work. Does it look right?

# Time-stamp: "2002-09-29 23:13:56 MDT"

die "What to make?" unless -e "Makefile.PL";

my %preexisting;
@preexsting{ glob('*.tar.gz') } = ();

system( "perl Makefile.PL && make manifest && make disttest && make dist && make clean" ) and die;

my @new = grep !exists $preexisting{$_}, glob('*.tar.gz');
die "No new .tar.gz's !?!" unless @new;
die "Too many new .tar.gz's !!" unless @new == 1;
my $new = $new[0];
system(" chmod a+r $new && mv $new ~/public_html/ ");

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • First of all (from merlyn) system "perl Makefile.PL" and die; system "make", qw(manifest disttest dist clean) and die; or !system "perl Makefile.PL" or die; !system "make", qw(manifest disttest dist clean) or die; to make it more parsable for atleast my mind.
  • doing a make disttest followed by a make dist on the perls I use puts the entire disttest directory into the distro, doubling its size and making it build twice when you unpackage it. I'm not sure if/when that bug was fixed.
  • I have always created my CPAN tarballs by hand, so I was delighted to try your script and I like it (apart from the 'preexsting' typo ;). I suppose you might replace:

    system(" chmod a+r $new && mv $new ~/public_html/ ");

    with something like:

    chmod(0644, $new) or die "chmod '$new' failed: $!";
    rename($new, "$ENV{HOME}/public_html/$new") or die "rename '$new' failed: $!";

    One annoyance I noticed is that it seems to put MANIFEST.bak and Makefile.old into the tarball. Also, is it correct practice to

    • Oops, I forgot to mention my MAKEFILE.SKIP file, which I think I inherited from someone...

      Maybe I should add "^dist" and/or "^disttest" to that?

      I like your (and everyone's) suggestions. I'll work them in.

      • TorgoX, I think you meant MANIFEST.SKIP and not MAKEFILE.SKIP. I have got it working nicely now, though I found the MANIFEST.SKIP file to be tempermental in the extreme. This is my MANIFEST.SKIP:


        For a while, I was plagued by the "double distribution" problem mentioned by Matts, but I deleted my MANIFEST file and have not seen this problem since (I am running Perl 5.6.1).