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