Peter Shangov > CPAN-Local-0.007 > CPAN::Local::Distribution::Role::FromURI

Download:
CPAN-Local-0.007.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.007   Source   Latest Release: CPAN-Local-0.010

NAME ^

CPAN::Local::Distribution::Role::FromURI - Allow distributions to be fetched from remote uris

VERSION ^

version 0.007

DESCRIPTION ^

This role allows a distribution object to be created from a remote URI rather than from a local file. The URI will be fetched and saved locally, and "filename" in CPAN::Local::Distribution will be set to the local file's name.

  package CPAN::Local::Distribution::Custom
  {
    use Moose;
    extends 'CPAN::Local::Distribution';
    with 'CPAN::Local::Distribution::Role::FromURI';
  }

  package main
  {
    my $distro = CPAN::Local::Distribution::Custom->new(
        uri   => 'http:://www.somepan.org/authors/id/F/FO/FOOBAR/Foo-Bar-0.001.tar.gz',
        cache => '/path/to/cache'
    );

    say $distro->filename; # /path/to/cache/authors/id/F/FO/FOOBAR/Foo-Bar-0.001.tar.gz
    say $distro->authorid; # FOOBAR
  }

ATTRIBUTES ^

uri

The remote distribution URI. The last part of the path must be a valid distribution name.

cache

Directory where the distribution will be downloaded to. A temporarary directory will be used if none is specified. If the distribution already exists in the cache, it will not be downloaded again.

AUTHOR ^

Peter Shangov <pshangov@yahoo.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Venda, Inc..

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

syntax highlighting: