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("..");