The Perl mantra with Shell.pm

ferreira on 2006-07-07T16:22:37

Get a CPAN distribution from web, untar the ball, invoke the Perl mantra to install what you got. That may be easy with Shell.pm. Of course to cover all cases (install dependencies, account for tool-challenged OSes, consider that things may fail), you will end up writing something like the CPAN shell.

#!/usr/bin/perl -w

use Shell qw(wget tar perl make);

my $url = shift; wget($url); die "can't wget" if $?; my ($ball) = $url =~ /([^\/]+)$/; tar('xfz', $ball); die "can't untar" if $?; my ($distdir) = $ball =~ /^(.*)\.tar\.gz$/; chdir($distdir) or die "can't chdir";

# the mantra perl("Makefile.PL"); die "perl Makefile.PL failed" if $?; make(); die "make failed" if $?; make("test"); die "make test failed" if $?; make("install"); die "make install failed" if $?;

chdir("..");


My favourite part

rafael on 2006-07-07T16:26:28

perl("Makefile.PL");