Daniel Falkenberg [[EMAIL PROTECTED]] quoth:
*>G'day All,
*>
*>I was just wondering if any one here has any experience with download
*>Perl CPAN modules from a Perl script.  I have looked at CPAN.pm but am a
*>little confused by this.
*>
*>I have tried the following...
*>
*>#!/usr/bin/perl -w
*>
*>use strict;
*>
*>#Check if a module exists... if it doesn't then ask the user with
*><STDIN> Y or N if they want to download and install it.
*>
*>Can any one give me a helping hand with this?

Well, if you are going to use CPAN.pm for this a 'use CPAN;' at the top of
the script will probably be helpful. And, in the documentation, there is
an example;

#!/usr/bin/perl 

use CPAN;

for $mod (qw(Net::FTP MD5 Data::Dumper)){
        my $obj = CPAN::Shell->expand('Module',$mod);
        $obj->install;
    }

---

which would install Net::FTP, MD5 and Data::Dumper. So, if you want the
user to supply the argument...

#!/usr/bin/perl

use CPAN;

print "Module to install: ";
my $module = <STDIN>;
chop $module;

for $mod($module){
        my $obj = CPAN::Shell->expand('Module',$mod);
        $obj->install;
    }

---

You can get more fancy from there....

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to