line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Specifies a distribution by author and archive |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Target::Distribution; |
4
|
|
|
|
|
|
|
|
5
|
56
|
|
|
56
|
|
57253
|
use Moose; |
|
56
|
|
|
|
|
402050
|
|
|
56
|
|
|
|
|
496
|
|
6
|
56
|
|
|
56
|
|
366931
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
56
|
|
|
|
|
23353
|
|
|
56
|
|
|
|
|
504
|
|
7
|
56
|
|
|
56
|
|
184186
|
use MooseX::Types::Moose qw(ArrayRef Str); |
|
56
|
|
|
|
|
46458
|
|
|
56
|
|
|
|
|
607
|
|
8
|
|
|
|
|
|
|
|
9
|
56
|
|
|
56
|
|
264755
|
use Pinto::Types qw(AuthorID); |
|
56
|
|
|
|
|
139
|
|
|
56
|
|
|
|
|
465
|
|
10
|
56
|
|
|
56
|
|
320053
|
use Pinto::Util qw(throw author_dir); |
|
56
|
|
|
|
|
141
|
|
|
56
|
|
|
|
|
3632
|
|
11
|
|
|
|
|
|
|
|
12
|
56
|
|
|
56
|
|
496
|
use overload ( '""' => 'to_string' ); |
|
56
|
|
|
|
|
122
|
|
|
56
|
|
|
|
|
462
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.13'; # VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has author => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => AuthorID, |
23
|
|
|
|
|
|
|
coerce => 1, |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has archive => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => Str, |
30
|
|
|
|
|
|
|
required => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has subdirs => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
isa => ArrayRef[Str], |
36
|
|
|
|
|
|
|
default => sub { [] }, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
around BUILDARGS => sub { |
42
|
|
|
|
|
|
|
my $orig = shift; |
43
|
|
|
|
|
|
|
my $class = shift; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my @args = @_; |
46
|
|
|
|
|
|
|
if ( @args == 1 and not ref $args[0] ) { |
47
|
|
|
|
|
|
|
my @path_parts = split m{/+}x, $args[0]; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $author = shift @path_parts; # First element |
50
|
|
|
|
|
|
|
my $archive = pop @path_parts; # Last element |
51
|
|
|
|
|
|
|
my $subdirs = [@path_parts]; # Everything else |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
throw "Invalid distribution target: $args[0]" |
54
|
|
|
|
|
|
|
if not( $author and $archive ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
@args = ( author => $author, subdirs => $subdirs, archive => $archive ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return $class->$orig(@args); |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub path { |
66
|
7
|
|
|
7
|
1
|
20
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
7
|
|
|
|
|
248
|
my $author_dir = author_dir($self->author); |
69
|
7
|
|
|
|
|
570
|
my @subdirs = @{ $self->subdirs }; |
|
7
|
|
|
|
|
191
|
|
70
|
7
|
|
|
|
|
159
|
my $archive = $self->archive; |
71
|
|
|
|
|
|
|
|
72
|
7
|
|
|
|
|
36
|
return join '/', $author_dir, @subdirs, $archive; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub to_string { |
79
|
54
|
|
|
54
|
1
|
1706
|
my ($self) = @_; |
80
|
|
|
|
|
|
|
|
81
|
54
|
|
|
|
|
1865
|
my $author = $self->author; |
82
|
54
|
|
|
|
|
135
|
my @subdirs = @{ $self->subdirs }; |
|
54
|
|
|
|
|
1441
|
|
83
|
54
|
|
|
|
|
1367
|
my $archive = $self->archive; |
84
|
|
|
|
|
|
|
|
85
|
54
|
|
|
|
|
402
|
return join '/', $author, @subdirs, $archive; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding UTF-8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Pinto::Target::Distribution - Specifies a distribution by author and archive |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 VERSION |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
version 0.13 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 METHODS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 path() |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns the canonical string form of this DistributionSpec, which is suitable |
116
|
|
|
|
|
|
|
for constructing a URI. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 to_string |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Serializes this Target to its string form. This method is called whenever the |
121
|
|
|
|
|
|
|
Target is evaluated in string context. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
132
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |