| 1 | package CPAN::Repository::Mailrc; | ||||||||||
| 2 | 2 | our $AUTHORITY = 'cpan:GETTY'; | |||||||||
| 3 | # ABSTRACT: 01mailrc | ||||||||||
| 4 | 2 | $CPAN::Repository::Mailrc::VERSION = '0.009'; | |||||||||
| 5 | 2 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | with qw( | |||||||||
| 8 | CPAN::Repository::Role::File | ||||||||||
| 9 | ); | ||||||||||
| 10 | |||||||||||
| 11 | 17 | ▶ | sub file_parts { 'authors', '01mailrc.txt' } | ||||||||
|
Subroutine
file_parts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 2 | has aliases => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | lazy => 1, | ||||||||||
| 16 | builder => '_build_aliases', | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | sub _build_aliases { | ||||||||||
| 20 | 2 | ▶ | my ( $self ) = @_; | ||||||||
|
Subroutine
_build_aliases: called CC=4 SCAR=13.9
| |||||||||||
| 21 | 2 | ▶ | return {} unless $self->exist; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 1 | my @lines = $self->get_file_lines; | |||||||||
| 23 | 1 | my %aliases; | |||||||||
| 24 | 1 | for (@lines) { | |||||||||
| 25 | 2 | ▶ | if ($_ =~ m/^alias (\w+) "(.*)"$/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 2 | $aliases{$1} = $2; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | 1 | return \%aliases; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | sub set_alias { | ||||||||||
| 33 | 2 | ▶ | my ( $self, $author, $alias ) = @_; | ||||||||
|
Subroutine
set_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | 2 | $self->aliases->{$author} = $alias; | |||||||||
| 35 | 2 | return $self; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | sub get_alias { | ||||||||||
| 39 | 0 | ▶ | my ( $self, $author ) = @_; | ||||||||
|
Subroutine
get_alias: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 40 | return defined $self->aliases->{$author} | ||||||||||
| 41 | 0 | ▶ | ? $self->aliases->{$author} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | : (); | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub generate_content { | ||||||||||
| 46 | 3 | ▶ | my ( $self ) = @_; | ||||||||
|
Subroutine
generate_content: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 47 | 3 | my $content = ""; | |||||||||
| 48 | 3 | for (sort { $a cmp $b } keys %{$self->aliases}) { | |||||||||
| 49 | 3 | ▶ | $content .= 'alias '.$_.' "'.( $self->aliases->{$_} ? $self->aliases->{$_} : $_ ).'"'."\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | } | ||||||||||
| 51 | 3 | return $content; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 2 | 1; | |||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||
| 57 | |||||||||||
| 58 | =pod | ||||||||||
| 59 | |||||||||||
| 60 | =head1 NAME | ||||||||||
| 61 | |||||||||||
| 62 | CPAN::Repository::Mailrc - 01mailrc | ||||||||||
| 63 | |||||||||||
| 64 | =head1 VERSION | ||||||||||
| 65 | |||||||||||
| 66 | version 0.009 | ||||||||||
| 67 | |||||||||||
| 68 | =head1 SYNOPSIS | ||||||||||
| 69 | |||||||||||
| 70 | use CPAN::Repository::Mailrc; | ||||||||||
| 71 | |||||||||||
| 72 | my $mailrc = CPAN::Repository::Mailrc->new({ | ||||||||||
| 73 | repository_root => $fullpath_to_root, | ||||||||||
| 74 | }); | ||||||||||
| 75 | |||||||||||
| 76 | =encoding utf8 | ||||||||||
| 77 | |||||||||||
| 78 | =head1 SEE ALSO | ||||||||||
| 79 | |||||||||||
| 80 | L<CPAN::Repository> | ||||||||||
| 81 | |||||||||||
| 82 | =head1 SUPPORT | ||||||||||
| 83 | |||||||||||
| 84 | IRC | ||||||||||
| 85 | |||||||||||
| 86 | Join #duckduckgo on irc.freenode.net. Highlight Getty for fast reaction :). | ||||||||||
| 87 | |||||||||||
| 88 | Repository | ||||||||||
| 89 | |||||||||||
| 90 | http://github.com/Getty/p5-cpan-repository | ||||||||||
| 91 | Pull request and additional contributors are welcome | ||||||||||
| 92 | |||||||||||
| 93 | Issue Tracker | ||||||||||
| 94 | |||||||||||
| 95 | http://github.com/Getty/p5-cpan-repository/issues | ||||||||||
| 96 | |||||||||||
| 97 | =head1 AUTHOR | ||||||||||
| 98 | |||||||||||
| 99 | Torsten Raudssus <torsten@raudss.us> L<http://raudss.us/> | ||||||||||
| 100 | |||||||||||
| 101 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 102 | |||||||||||
| 103 | This software is copyright (c) 2012 by DuckDuckGo, Inc. L<http://duckduckgo.com/>. | ||||||||||
| 104 | |||||||||||
| 105 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 106 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 107 | |||||||||||
| 108 | =cut | ||||||||||