| 1 | # ABSTRACT: Base class for Locators | ||||||||||
| 2 | |||||||||||
| 3 | package Pinto::Locator; | ||||||||||
| 4 | |||||||||||
| 5 | 61 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 61 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 61 | ▶ | use MooseX::MarkAsMethods (autoclean => 1); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 61 | ▶ | use Pinto::Types qw(Dir Uri); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 61 | ▶ | use Pinto::Util qw(throw tempdir); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | #------------------------------------------------------------------------ | ||||||||||
| 13 | |||||||||||
| 14 | 61 | our $VERSION = '0.14'; # VERSION | |||||||||
| 15 | |||||||||||
| 16 | #------------------------------------------------------------------------ | ||||||||||
| 17 | |||||||||||
| 18 | 61 | with qw(Pinto::Role::UserAgent); | |||||||||
| 19 | |||||||||||
| 20 | #------------------------------------------------------------------------ | ||||||||||
| 21 | |||||||||||
| 22 | 61 | has uri => ( | |||||||||
| 23 | is => 'ro', | ||||||||||
| 24 | isa => Uri, | ||||||||||
| 25 | default => 'http://backpan.perl.org', | ||||||||||
| 26 | coerce => 1, | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | 61 | has cache_dir => ( | |||||||||
| 30 | is => 'ro', | ||||||||||
| 31 | isa => Dir, | ||||||||||
| 32 | default => \&tempdir, | ||||||||||
| 33 | ); | ||||||||||
| 34 | |||||||||||
| 35 | #------------------------------------------------------------------------ | ||||||||||
| 36 | |||||||||||
| 37 | 5 | ▶ | sub locate { | ||||||||
|
Subroutine
locate: called CC=5 SCAR=20.9
Pod
undocumented
| |||||||||||
| 38 | 5 | my ($self, %args) = @_; | |||||||||
| 39 | |||||||||||
| 40 | 5 | ▶ | $args{target} || throw 'Invalid arguments'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | |||||||||||
| 42 | $args{target} = Pinto::Target->new($args{target}) | ||||||||||
| 43 | 5 | ▶ | if not ref $args{target}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | |||||||||||
| 45 | return $self->locate_package(%args) | ||||||||||
| 46 | 5 | ▶ | if $args{target}->isa('Pinto::Target::Package'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | |||||||||||
| 48 | return $self->locate_distribution(%args) | ||||||||||
| 49 | 0 | ▶ | if $args{target}->isa('Pinto::Target::Distribution'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | throw 'Invalid arguments'; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | #------------------------------------------------------------------------ | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub locate_package { die 'Abstract method'} | ||||||||
|
Subroutine
locate_package: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | |||||||||||
| 58 | #------------------------------------------------------------------------ | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub locate_distribution { die 'Abstract method'} | ||||||||
|
Subroutine
locate_distribution: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | |||||||||||
| 62 | #------------------------------------------------------------------------ | ||||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | sub refresh {} | ||||||||
|
Subroutine
refresh: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 65 | |||||||||||
| 66 | #------------------------------------------------------------------------ | ||||||||||
| 67 | |||||||||||
| 68 | 61 | __PACKAGE__->meta->make_immutable; | |||||||||
| 69 | |||||||||||
| 70 | #------------------------------------------------------------------------ | ||||||||||
| 71 | 61 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||