blib/lib/Pinto/Locator.pm

filter: Statementstmt 86.2% 25 / 29 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 4 totaltotal 68.0% 34 / 50 CC 5 SCAR 13.6
CC
5
Cov
76%
locate
8.1
locate_package
2.0
locate_distribution
2.0
CRAP 3.9
« blib/lib/Pinto/Action/Pull.pm ↑ Summary blib/lib/Pinto/Schema.pm »
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
BranchTrueFalseTotal
$args{"target"} or throw("Invalid arguments") 5 0 5
41  
42 $args{target} = Pinto::Target->new($args{target})
43 5 ▶ if not ref $args{target};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"target"} 0 5 5
44  
45 return $self->locate_package(%args)
46 5 ▶ if $args{target}->isa('Pinto::Target::Package');
Branch: 1 branch
BranchTrueFalseTotal
if $args{"target"}->isa("Pinto::Target::Package") 5 0 5
47  
48 return $self->locate_distribution(%args)
49 0 ▶ if $args{target}->isa('Pinto::Target::Distribution');
Branch: 1 branch
BranchTrueFalseTotal
if $args{"target"}->isa("Pinto::Target::Distribution") 0 0 0
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__
« blib/lib/Pinto/Action/Pull.pm ↑ Summary blib/lib/Pinto/Schema.pm »