Stories
Slash Boxes
Comments
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 ]

ferreira (5993)

ferreira
  (email not shown publicly)
http://www.ferreira.triang.net/

Just another Brazilian Perl hacker.

Journal of ferreira (5993)

Friday July 07, 2006
11:22 AM

The Perl mantra with Shell.pm

[ #30207 ]
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("..");

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.