line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Index::API::File::MailRc; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$CPAN::Index::API::File::MailRc::VERSION = '0.007'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Interface to 01mailrc.txt |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
127351
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
10
|
1
|
|
|
1
|
|
6
|
use Scalar::Util qw(blessed); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
11
|
1
|
|
|
1
|
|
856
|
use namespace::autoclean; |
|
1
|
|
|
|
|
25219
|
|
|
1
|
|
|
|
|
7
|
|
12
|
1
|
|
|
1
|
|
1117
|
use Moose; |
|
1
|
|
|
|
|
467995
|
|
|
1
|
|
|
|
|
8
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with qw( |
15
|
|
|
|
|
|
|
CPAN::Index::API::Role::Writable |
16
|
|
|
|
|
|
|
CPAN::Index::API::Role::Readable |
17
|
|
|
|
|
|
|
CPAN::Index::API::Role::Clonable |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has authors => ( |
21
|
|
|
|
|
|
|
is => 'bare', |
22
|
|
|
|
|
|
|
isa => 'ArrayRef', |
23
|
|
|
|
|
|
|
default => sub { [] }, |
24
|
|
|
|
|
|
|
traits => ['Array'], |
25
|
|
|
|
|
|
|
handles => { |
26
|
|
|
|
|
|
|
author_count => 'count', |
27
|
|
|
|
|
|
|
authors => 'elements', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub sorted_authors { |
32
|
1
|
|
|
1
|
1
|
983
|
my $self = shift; |
33
|
1
|
|
|
|
|
57
|
return sort { $a->{authorid} cmp $b->{authorid} } $self->authors; |
|
3
|
|
|
|
|
59
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub parse { |
37
|
1
|
|
|
1
|
1
|
3
|
my ( $self, $content ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
2
|
my @authors; |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
4
|
if ($content) |
42
|
|
|
|
|
|
|
{ |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
4
|
foreach my $line ( split "\n", $content ) { |
45
|
3
|
|
|
|
|
8
|
my ( $alias, $authorid, $long ) = split ' ', $line, 3; |
46
|
3
|
|
|
|
|
9
|
$long =~ s/^"//; |
47
|
3
|
|
|
|
|
9
|
$long =~ s/"$//; |
48
|
3
|
|
|
|
|
9
|
my ($name, $email) = $long =~ /(.*) <(.+)>$/; |
49
|
|
|
|
|
|
|
|
50
|
3
|
100
|
|
|
|
9
|
undef $email if $email eq 'CENSORED'; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
10
|
my $author = { |
53
|
|
|
|
|
|
|
authorid => $authorid, |
54
|
|
|
|
|
|
|
name => $name, |
55
|
|
|
|
|
|
|
email => $email, |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
8
|
push @authors, $author; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
5
|
return ( authors => \@authors ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
|
sub default_location { 'authors/01mailrc.txt.gz' } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
CPAN::Index::API::File::MailRc - Interface to 01mailrc.txt |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 0.007 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $mailrc = CPAN::Index::File::MailRc->parse_from_repo_uri( |
85
|
|
|
|
|
|
|
'http://cpan.perl.org' |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
foreach my $author ($mailrc->sorted_authors) { |
89
|
|
|
|
|
|
|
... # do something |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This is a class to read and write 01mailrc.txt |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 authors |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
List of hashres containing author data. The structure of the hashrefs is |
101
|
|
|
|
|
|
|
as follows: |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item authorid |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
CPAN id of the author. This should be a string containing only capital latin |
108
|
|
|
|
|
|
|
letters and is at least 2 characters long. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item name |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Author's full name. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item email |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Author's email. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 sorted_authors |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
List of authors sorted by pause id. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 parse |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Parses the file and reurns its representation as a data structure. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 default_location |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Default file location - C<authors/01mailrc.txt.gz>. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 METHODS FROM ROLES |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=over |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item <CPAN::Index::API::Role::Readable/read_from_string> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item <CPAN::Index::API::Role::Readable/read_from_file> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item <CPAN::Index::API::Role::Readable/read_from_tarball> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item <CPAN::Index::API::Role::Readable/read_from_repo_path> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item <CPAN::Index::API::Role::Readable/read_from_repo_uri> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/tarball_is_default> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/repo_path> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/template> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/content> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/write_to_file> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Writable/write_to_tarball> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item L<CPAN::Index::API::Role::Clonable/clone> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=back |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 AUTHOR |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Peter Shangov <pshangov@yahoo.com> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Venda, Inc.. |
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 |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
__DATA__ |
177
|
|
|
|
|
|
|
[% |
178
|
|
|
|
|
|
|
foreach my $author ($self->sorted_authors) { |
179
|
|
|
|
|
|
|
$OUT .= sprintf qq[alias %s "%s <%s>"\n], |
180
|
|
|
|
|
|
|
$author->{authorid}, |
181
|
|
|
|
|
|
|
$author->{name}, |
182
|
|
|
|
|
|
|
$author->{email} ? $author->{email} : 'CENSORED'; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
%] |