Click here to get back home

download all CPAN modules ?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
download all CPAN modules ? ravi 08-25-2004
Posted by ravi on August 25, 2004, 10:35 pm
Please log in for more thread options
Is there a way I can easily install ALL the modules on CPAN
in one stroke ?
Something like a tar or ZIP file ?


Posted by John Bokma on August 26, 2004, 8:26 am
Please log in for more thread options
rsdivekar@hotmail.com (ravi) wrote in news:aaa32b5e.0408252035.63630e97
@posting.google.com:

> Is there a way I can easily install ALL the modules on CPAN
> in one stroke ?
> Something like a tar or ZIP file ?

Why? Some have similar functionality, some are probably outdated, and most
you will never (say never) use.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html


Posted by Michael Meissner on August 26, 2004, 1:01 pm
Please log in for more thread options

> rsdivekar@hotmail.com (ravi) wrote in news:aaa32b5e.0408252035.63630e97
> @posting.google.com:
>
> > Is there a way I can easily install ALL the modules on CPAN
> > in one stroke ?
> > Something like a tar or ZIP file ?
>
> Why? Some have similar functionality, some are probably outdated, and most
> you will never (say never) use.

If you have high bandwidth at limited times (say at work), and very limited or
no bandwidth at other times (say at home or in a laptop while traveling), it is
much more convenient to download everything, rather than download a package you
want, and then discover the 3 packages it depends on, and the 6 packages those
other packages use.

--
Michael Meissner
email: mrmnews@the-meissners.org
http://www.the-meissners.org


Posted by Ted Zlatanov on August 26, 2004, 1:44 pm
Please log in for more thread options
On 26 Aug 2004, mrmnews@the-meissners.org wrote:

>
>> rsdivekar@hotmail.com (ravi) wrote in
>>
>> > Is there a way I can easily install ALL the modules on CPAN in
>> > one stroke ? Something like a tar or ZIP file ?
>>
>> Why? Some have similar functionality, some are probably outdated,
>> and most you will never (say never) use.
>
> If you have high bandwidth at limited times (say at work), and very
> limited or no bandwidth at other times (say at home or in a laptop
> while traveling), it is much more convenient to download everything,
> rather than download a package you want, and then discover the 3
> packages it depends on, and the 6 packages those other packages use.

You can always run your own CPAN mirror... It doesn't have to be
public to be useful.

rsync -a --delete cpan-mirror-name-goes-here::CPAN /myCPAN

Installing every CPAN module is not a valid requirement. The MySQL
bundle, for instance, is not useful without MySQL and its associated
libraries, and probably won't even install. What the OP probably
wants is his own CPAN mirror.

Ted


Posted by DominiX on August 29, 2004, 7:33 pm
Please log in for more thread options
ici même:4ny8k1alxd.fsf@lifelogs.com,

> You can always run your own CPAN mirror... It doesn't have to be
> public to be useful.
>

WOW, too big, it take a few GIG.

I wrote this once a day a was in need of such a feature
it mirror just active modules.

--
#!/usr/bin/perl
# under GPL;
# this script is supposed to take place in
# $CPAN::Config-> . "/sources"
# ie:
# perl -MCPAN::Config -l012e 'print $CPAN::Config->."/sources"'
# so it become directly usable by cpan utility.
use strict;
use warnings;
use LWP::Simple;
use Compress::Zlib;
use File::Basename;
use File::Path;
use File::Find;
use vars qw/*name *dir *prune/;
use CPAN::Config;

my $basearg = scalar($#ARGV) == -1 ? $}[0] :
$ARGV[0];

die "usage $0 URL(that indicate a CPAN root miror)" if $basearg eq "";

my ($proto,$filler,$host,$relative)=split("/",$basearg,4);
die "bad URL: @ARGV" if ( $filler ne "" || $host eq "");

my @list;
my $realf;
my ($Fld1,$Fld2,$Fld3) ;
my %seen ;
my @realfiles;
my $base;

*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;

my $file='modules/02packages.details.txt.gz';
$relative = "" if not defined $relative ;
$relative = $relative eq "" ? "" : $relative . "/";
my $url = $proto . "//" . $host . "/" . $relative ;
print "fetching from $urln" . $file;

$|=1;
my $httpresponse = mirror($url . $file ,$file);
die "Couldn't get it! $httpresponse" unless defined $httpresponse;
print " HTTP response:$httpresponsen";

my $gz = gzopen($file, "rb")
or die "ARRG Cannot open $file: $gzerrnon" ;
while ($gz->gzreadline($_)) {
($Fld1,$Fld2,$Fld3) = split(' ', $_, 9999);
next if ! defined($Fld3);
next if $Fld3=~ m ;# added when discovered merlyn has
# already done this better than me
if (/[gz|zip]$/) {
push(@list, 'authors/id/' . $Fld3) unless $seen++;
}
}
die "Error reading from $file: $gzerrno" . ($gzerrno+0) . "n"
if $gzerrno != Z_STREAM_END ;
$gz->gzclose();
$file="modules/03modlist.data.gz";
print $file," HTTP response:";
$httpresponse = mirror($url . $file ,$file);
print $httpresponse . "n";
$file="authors/01mailrc.txt.gz";
print $file," HTTP response:";
$httpresponse = mirror($url . $file ,$file);
print $httpresponse . "n";

foreach (@list) {
if (! -e $_) {
$base = dirname($_);
if (! -d $base) { mkpath $base };
print $_," HTTP response:";
$httpresponse = mirror($url . $_ ,$_);
print $httpresponse;
$httpresponse = mirror($url . $base . "/CHECKSUMS" ,$base .
"/CHECKSUMS" );
print " CHECKSUMS $httpresponsen";
}
}

# now , cleanup the old version, if exists ...

sub wanted {
my ($dev,$ino,$mode,$nlink,$uid,$gid);
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))
&& -f _ && push @realfiles,$name if $name=~ /(gz|zip)$/;
}

File::Find::find({wanted => &wanted}, 'authors/id');
@seen = ();

foreach $realf (@realfiles) {
print "cleanup of " . $realf . "n"
unless exists $seen;
unlink $realf unless exists $seen;
}

my $metad=$CPAN::Config->."/Metadata";
unlink $metad if -f $metad;




Similar ThreadsPosted
download Modules from CPAN and then load into Perl Question October 15, 2004, 3:07 pm
lwp-download http://..--how do I use it to download pages? June 8, 2008, 5:47 pm
To publish on CPAN or not? And architectural q. on modules. November 29, 2007, 12:56 pm
How to find all modules, required by a given CPAN module September 4, 2005, 2:25 am
querying modules dependency tree on CPAN November 19, 2004, 1:54 am
General question on CPAN perl modules March 13, 2005, 6:34 pm
Testing database code in CPAN modules April 4, 2005, 12:33 pm
weirdness with CPAN modules that use Data::Dumper June 30, 2007, 2:34 am
Issues Installing CPAN Modules on Win NT - Activestate Perl 5.61 November 19, 2004, 6:52 am
[RFC] What's a good CPAN root name for mobile and wireless modules? January 2, 2005, 4:49 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap