| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
49464
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
36
|
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Gentoo::Perl::Distmap; |
|
5
|
|
|
|
|
|
|
BEGIN { |
|
6
|
1
|
|
|
1
|
|
30
|
$Gentoo::Perl::Distmap::AUTHORITY = 'cpan:KENTNL'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
{ |
|
9
|
|
|
|
|
|
|
$Gentoo::Perl::Distmap::VERSION = '0.2.0'; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: A reader/writer for the C<metadata/perl/distmap.json> file. |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
25
|
use 5.010000; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
15
|
1
|
|
|
1
|
|
1823
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has map => ( |
|
20
|
|
|
|
|
|
|
isa => 'Gentoo::Perl::Distmap::Map', |
|
21
|
|
|
|
|
|
|
is => ro =>, |
|
22
|
|
|
|
|
|
|
default => sub { |
|
23
|
|
|
|
|
|
|
require Gentoo::Perl::Distmap::Map; |
|
24
|
|
|
|
|
|
|
Gentoo::Perl::Distmap::Map->new(); |
|
25
|
|
|
|
|
|
|
}, |
|
26
|
|
|
|
|
|
|
handles => [qw( multi_repository_dists all_mapped_dists mapped_dists dists_in_repository add_version )], |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub load { |
|
31
|
|
|
|
|
|
|
my ( $self, $method, $source ) = @_; |
|
32
|
|
|
|
|
|
|
require Gentoo::Perl::Distmap::Map; |
|
33
|
|
|
|
|
|
|
return $self->new( |
|
34
|
|
|
|
|
|
|
map => Gentoo::Perl::Distmap::Map->from_rec( |
|
35
|
|
|
|
|
|
|
$self->decoder->decode( $self->can( '_load_' . $method )->( $self, $method, $source ) ) |
|
36
|
|
|
|
|
|
|
) |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub save { |
|
42
|
|
|
|
|
|
|
my ( $self, $method, $target ) = @_; |
|
43
|
|
|
|
|
|
|
return $self->can( '_save_' . $method )->( $self, $self->encoder->encode( $self->map->to_rec ), $target ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _save_string { return $_[1] } |
|
48
|
|
|
|
|
|
|
sub _save_filehandle { return $_[2]->print( $_[1] ) } |
|
49
|
|
|
|
|
|
|
sub _save_file { require Path::Tiny; return $_[0]->_save_filehandle( $_[1], Path::Tiny::path( $_[2] )->openw() ) } |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _load_file { require Path::Tiny; return scalar Path::Tiny::path( $_[2] )->slurp() } |
|
53
|
|
|
|
|
|
|
sub _load_filehandle { local $/ = undef; return scalar $_[2]->getline } |
|
54
|
|
|
|
|
|
|
sub _load_string { return $_[2] } |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub decoder { |
|
58
|
|
|
|
|
|
|
return state $json = do { require JSON; JSON->new->pretty->utf8->canonical; } |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub encoder { |
|
62
|
|
|
|
|
|
|
return state $json = do { require JSON; JSON->new->pretty->utf8->canonical; } |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
65
|
|
|
|
|
|
|
no Moose; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=encoding utf-8 |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Gentoo::Perl::Distmap - A reader/writer for the C<metadata/perl/distmap.json> file. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
version 0.2.0 |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $dm = Gentoo::Perl::Distmap->load( file => '../path/to/distmap.json' ); |
|
86
|
|
|
|
|
|
|
$dm->save( file => '/tmp/foo.x' ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
for my $dist ( sort $dm->dists_in_repository('gentoo') ) { |
|
89
|
|
|
|
|
|
|
/* see the upstream distnames visible in gentoo */ |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
for my $dist ( sort $dm->dists_in_repository('perl-experimental') ) { |
|
92
|
|
|
|
|
|
|
/* see the upstream distnames visible in perl-experimental */ |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
for my $dist ( sort $dm->multi_repository_dists ) { |
|
95
|
|
|
|
|
|
|
/* see the dists that exist in more than one repository */ |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
- for my $dist ( sort $dm->mapped_dists ) { |
|
98
|
|
|
|
|
|
|
/* see the dists that have at least one version in the dataset */ |
|
99
|
|
|
|
|
|
|
/* note: dists with empty version sets should be deemed a bug */ |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Interface for creating/augmenting/comparing C<.json> files still to be defined, basic functionality only at this time. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 map |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 METHODS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 save |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$instance->save( file => $filepath ); |
|
113
|
|
|
|
|
|
|
$instance->save( filehandle => $fh ); |
|
114
|
|
|
|
|
|
|
my $string = $instance->save( string => ); |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 CLASS METHODS |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 load |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $instance = G:P:Distmap->load( file => $filepath ); |
|
121
|
|
|
|
|
|
|
my $instance = G:P:Distmap->load( filehandle => $fh ); |
|
122
|
|
|
|
|
|
|
my $instance = G:P:Distmap->load( string => $str ); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 decoder |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
$decoder = G:P:Distmap->decoder(); |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 encoder |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$encoder = G:P:Distmap->encoder(); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 ATTRIBUTE METHODS |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 map -> map |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 multi_repository_dists -> map |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 all_mapped_dists -> map |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 mapped_dists -> map |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 dists_in_repository -> map |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 add_version -> map |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 _save_string |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 _save_filehandle |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 _save_file |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 PRIVATE CLASS METHODS |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 _load_file |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 _load_filehandle |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 _load_string |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 AUTHOR |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Kent Fredric <kentfredric@gmail.com> |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
171
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |