| CPAN-Mini-FromList documentation | Contained in the CPAN-Mini-FromList distribution. |
CPAN::Mini::FromList - create a minimal CPAN mirror of modules you specify
Unless you need to do something unusual, you probably should be looking
at minicpan-fromlist.
use CPAN::Mini::FromList;
CPAN::Mini::FromList->update_mirror(%args);
...
Begins the process of creating a local CPAN mirror, but only downloads modules specified by the user. See the documentation in CPAN::Mini for more details on the arguments.
Delete 02packages.details.txt.gz
Generate a fake 02packages.details.txt.gz containing only the packages listed.
Thomas Klausner, domm@cpan.org
based on CPAN::Mini::Phalanx100 by Steve Peters
Please report any bugs or feature requests to
bug-cpan-mini-fromlist@rt.cpan.org, or through the web interface at
http://rt.cpan.org. I will be notified, and then you'll automatically
be notified of progress on your bug as I make changes.
Thanks to...
Ricardo Signes - for writing CPAN::Mini, which does 99% of the work in this module
Steve Peters - for writing CPAN::Mini::Phalanx100, from which I copied most of this code
Copyright 2008 Thomas Klausner, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| CPAN-Mini-FromList documentation | Contained in the CPAN-Mini-FromList distribution. |
package CPAN::Mini::FromList; use warnings; use strict; use CPAN::Mini; use Data::Dumper; use File::Spec::Functions; use base qw(CPAN::Mini); our $VERSION = '0.02';
our %dists = (); sub update_mirror { my $self = shift; my @args = @_; my %args=@args; foreach my $d (@{$args{list}}) { $dists{$d} = 1; } CPAN::Mini->update_mirror(@args, 'module_filters', [\&_fromlist_filter]); } sub _fromlist_filter { my $module = shift; return 1 if ! $dists{$module}; return 0; }
sub delete_02packages { my ($class,$local)=@_; my $packages02=catfile($local,qw(modules 02packages.details.txt.gz)); if (-e $packages02) { unlink ($packages02) || die "Cannot unlink $packages02: $!"; } }
sub generate_fake_02packages { my ($class,$local)=@_; eval { my $packages=catfile($local,qw(modules 02packages.details.txt)); my @files=File::Find::Rule->file()->name('*.gz')->relative->in( catdir($local,qw(authors id))); open(my $fh,'>',$packages) || die "Cannot write to $packages: $!"; my $linecnt=@files; my $now=scalar localtime; print $fh <<"EOHEAD"; File: 02packages.details.txt URL: http://www.perl.com/CPAN/modules/02packages.details.txt Description: Fake 02packges generate by CPAN::Mini::FromList Columns: package name, version, path Intended-For: Automated fetch routines, namespace documentation. Written-By: CPAN::Mini::FromList Line-Count: $linecnt Last-Updated: $now EOHEAD foreach (@files) { print $fh "Fake undef $_\n"; } close $fh; $class->delete_02packages($local); system('gzip',$packages); }; print $@ if $@; } q{ listening to: CPAN discussions at the Oslo QA Hackathon }; __END__