line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Repository::Mailrc; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
3
|
|
|
|
|
|
|
# ABSTRACT: 01mailrc |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.010'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with qw( |
10
|
|
|
|
|
|
|
CPAN::Repository::Role::File |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
17
|
|
|
17
|
0
|
411
|
sub file_parts { 'authors', '01mailrc.txt' } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has aliases => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
lazy => 1, |
18
|
|
|
|
|
|
|
builder => '_build_aliases', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _build_aliases { |
22
|
2
|
|
|
2
|
|
552
|
my ( $self ) = @_; |
23
|
2
|
100
|
|
|
|
12
|
return {} unless $self->exist; |
24
|
1
|
|
|
|
|
5
|
my @lines = $self->get_file_lines; |
25
|
1
|
|
|
|
|
471
|
my %aliases; |
26
|
1
|
|
|
|
|
3
|
for (@lines) { |
27
|
2
|
50
|
|
|
|
18
|
if ($_ =~ m/^alias (\w+) "(.*)"$/) { |
28
|
2
|
|
|
|
|
11
|
$aliases{$1} = $2; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
1
|
|
|
|
|
11
|
return \%aliases; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub set_alias { |
35
|
2
|
|
|
2
|
0
|
187
|
my ( $self, $author, $alias ) = @_; |
36
|
2
|
|
|
|
|
52
|
$self->aliases->{$author} = $alias; |
37
|
2
|
|
|
|
|
35
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_alias { |
41
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $author ) = @_; |
42
|
|
|
|
|
|
|
return defined $self->aliases->{$author} |
43
|
0
|
0
|
|
|
|
0
|
? $self->aliases->{$author} |
44
|
|
|
|
|
|
|
: (); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub generate_content { |
48
|
3
|
|
|
3
|
0
|
8
|
my ( $self ) = @_; |
49
|
3
|
|
|
|
|
10
|
my $content = ""; |
50
|
3
|
|
|
|
|
5
|
for (sort { $a cmp $b } keys %{$self->aliases}) { |
|
1
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
59
|
|
51
|
3
|
50
|
|
|
|
102
|
$content .= 'alias '.$_.' "'.( $self->aliases->{$_} ? $self->aliases->{$_} : $_ ).'"'."\n"; |
52
|
|
|
|
|
|
|
} |
53
|
3
|
|
|
|
|
39
|
return $content; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |