CPAN::Packager::Downloader::Fresh - Download cpan module tarball with App::CPAN::Fresh


CPAN-Packager documentation Contained in the CPAN-Packager distribution.

Index


Code Index:

NAME

Top

CPAN::Packager::Downloader::Fresh - Download cpan module tarball with App::CPAN::Fresh

SYNOPSIS

Top

DESCRIPTION

Top

CPAN::Packager::Downloader::Fresh

AUTHOR

Top

wafl443

SEE ALSO

Top

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


CPAN-Packager documentation Contained in the CPAN-Packager distribution.

package CPAN::Packager::Downloader::Fresh;
use Mouse;
use CPAN;
use App::CPAN::Fresh;
use CPAN::Packager::FileUtil qw(file dir);
use URI;
use Log::Log4perl qw(:easy);
with 'CPAN::Packager::Downloader::Role';

sub set_cpan_mirrors {
    my ( $self, $cpan_mirrors ) = @_;
    # not supported
}

sub download {
    my ( $self, $module ) = @_;
    INFO( "Downloading $module ..." );
    my $distribution = App::CPAN::Fresh->inject($module);
    my $mod          = CPAN::Shell->expand( "Module", $module );
    my $dist         = CPAN::Shell->expandany($distribution);

    return unless $mod;
    return unless $dist;
    $dist->get();
    my $archive = $dist->{localfile};    # FIXME: old CPAN does't have method?
    my $where   = $dist->dir();

    return () unless $archive;

    return $self->analyze_distname_info($archive, $where);
}

no Mouse;
__PACKAGE__->meta->make_immutable;
1;

__END__