line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: The package index of a repository |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::IndexReader; |
4
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
327
|
use Moose; |
|
51
|
|
|
|
|
112
|
|
|
51
|
|
|
|
|
428
|
|
6
|
51
|
|
|
51
|
|
329371
|
use MooseX::Types::Moose qw(HashRef); |
|
51
|
|
|
|
|
121
|
|
|
51
|
|
|
|
|
552
|
|
7
|
51
|
|
|
51
|
|
229220
|
use MooseX::MarkAsMethods (autoclean => 1); |
|
51
|
|
|
|
|
117
|
|
|
51
|
|
|
|
|
433
|
|
8
|
|
|
|
|
|
|
|
9
|
51
|
|
|
51
|
|
200543
|
use IO::Zlib; |
|
51
|
|
|
|
|
198093
|
|
|
51
|
|
|
|
|
375
|
|
10
|
|
|
|
|
|
|
|
11
|
51
|
|
|
51
|
|
2935
|
use Pinto::Types qw(File); |
|
51
|
|
|
|
|
123
|
|
|
51
|
|
|
|
|
503
|
|
12
|
51
|
|
|
51
|
|
304218
|
use Pinto::Util qw(throw); |
|
51
|
|
|
|
|
119
|
|
|
51
|
|
|
|
|
26211
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has index_file => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => File, |
23
|
|
|
|
|
|
|
required => 1, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has packages => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => HashRef, |
29
|
|
|
|
|
|
|
builder => '_build_packages', |
30
|
|
|
|
|
|
|
lazy => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _build_packages { |
36
|
35
|
|
|
35
|
|
110
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
35
|
|
|
|
|
943
|
my $file = $self->index_file->stringify; |
39
|
35
|
50
|
|
|
|
1514
|
my $fh = IO::Zlib->new($file, 'rb') or throw "Failed to open index file $file: $!"; |
40
|
35
|
|
|
|
|
76117
|
my $index_data = $self->__read_index($fh); |
41
|
35
|
|
|
|
|
178
|
close $fh; |
42
|
|
|
|
|
|
|
|
43
|
35
|
|
|
|
|
9053
|
return $index_data; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub __read_index { |
49
|
35
|
|
|
35
|
|
141
|
my ($self, $fh) = @_; |
50
|
|
|
|
|
|
|
|
51
|
35
|
|
|
|
|
98
|
my $inheader = 1; |
52
|
35
|
|
|
|
|
82
|
my $packages = {}; |
53
|
|
|
|
|
|
|
|
54
|
35
|
|
|
|
|
239
|
while (<$fh>) { |
55
|
|
|
|
|
|
|
|
56
|
23382
|
100
|
|
|
|
2361403
|
if ($inheader) { |
57
|
315
|
100
|
|
|
|
1038
|
$inheader = 0 if not m/ \S /x; |
58
|
315
|
|
|
|
|
845
|
next; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
23067
|
|
|
|
|
32050
|
chomp; |
62
|
23067
|
|
|
|
|
60178
|
my ($package, $version, $path) = split; |
63
|
23067
|
|
|
|
|
123360
|
$packages->{$package} = {name => $package, version => $version, path => $path}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
35
|
|
|
|
|
5100
|
return $packages |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding UTF-8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Pinto::IndexReader - The package index of a repository |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 0.14 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |