CPAN::Packager::Downloader::Role - Downloader role


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

Index


Code Index:

NAME

Top

CPAN::Packager::Downloader::Role - Downloader role

SYNOPSIS

Top

DESCRIPTION

Top

CPAN::Packager::Downloader::Role is the role which fetches a cpan module tarball from CPAN.

AUTHOR

Top

Takatoshi Kitano <kitano.tk@gmail.com>

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::Role;
use Mouse::Role;
use File::Basename;
use CPAN::DistnameInfo;

requires 'set_cpan_mirrors';
requires 'download';

sub analyze_distname_info {
    my ($self, $archive, $where) = @_;
    my $basename  = fileparse($archive);
    my $distro    = CPAN::DistnameInfo->new($basename);
    my $dist_name = $distro->dist;
    my $version   = $distro->version;
    $dist_name =~ s/-/::/g;

    return {
        tgz_path  => $archive,
        src_dir   => $where,
        version   => $version,
        dist_name => $dist_name
    };
}

1;

__END__