blib/lib/Acme/CPANAuthors/Acme/CPANAuthors/Authors.pm

filter: Statementstmt 34.1% 14 / 41 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 29.0% 18 / 62 CC 9 SCAR 37.4
CC
9
Cov
25%
__ANON__
72.0
_regen
6.0
BEGIN
1.0
CRAP 42.3
↑ Summary
1 package Acme::CPANAuthors::Acme::CPANAuthors::Authors;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 Acme::CPANAuthors::Acme::CPANAuthors::Authors - We are CPAN authors who have authored Acme::CPANAuthors modules
8  
9 =cut
10  
11 1 ▶use version; our $VERSION = version->declare('v1.0.0');
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Acme::CPANAuthors::Register (
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ABIGAIL => q[Abigail], # A::C::Dutch ...or not.
14 ACALPINI => q[Aldo Calpini], # A::C::Italian
15 ASHLEY => q[Ashley Pond V], # A::C::Misanthrope
16 AZAWAWI =>
17 q[أحمد محمد زواوي - Ahmad M. Zawawi], # A::C::Arabic
18 BARBIE => q[Barbie], # A::C::British
19 BINGOS => q[Chris Williams], # A::C::POE
20 BRACETA => q[Luís Azevedo], # A::C::Portuguese
21 BURAK => q[Burak Gürsoy], # A::C::Turkish
22 ETHER => q[Karen Etheridge], # A::C::Nonhuman
23 FAYLAND => q[Fayland 林], # A::C::Chinese
24 FLORA => q[Florian Ragwitz], # A::C::German
25 GARU => q[Breno G. de Oliveira], # A::C::Brazilian
26 GRAY => q[gray], # A::C::GitHub
27 GUGOD => q[劉康民], # A::C::Taiwanese
28 HINRIK => q[Hinrik Örn Sigurðsson], # A::C::Icelandic
29 ISHIGAKI => q[Kenichi Ishigaki], # The Original
30 JEEN => q[Jeen Lee], # A::C::Korean
31 JLMARTIN => q[Jose Luis Martinez Torres], # A::C::Catalonian
32 KAARE => q[Kaare Rasmussen], # A::C::Danish
33 KENTARO => q[Kentaro Kuribayashi], # A::C::GeekHouse
34 MARCEL => q[Marcel Grünauer == hanekomu], # A::C::Austrian
35 MONS => q[Mons Anderson], # A::C::AnyEvent
36 RBO => q[Robert Bohne], # A::C::German
37 SALVA => q[Salvador Fandiño García], # A::C::Spanish
38 SANKO => q[Sanko Robinson], # Hey, that's me!
39 SAPER => q[Sébastien Aperghis-Tramoni], # A::C::French
40 SFINK => q[Steve A Fink], # A::C::Not
41 SHANTANU => q[Shantanu Bhadoria], # A::C::India
42 SHARIFULN => q[Анатолий Шарифулин], # A::C::Russian
43 SHARYANTO => q[Steven Haryanto], # A::C::Indonesian
44 SHLOMIF => q[Shlomi Fish], # A::C::Israeli
45 SKIM => q[Michal Špaček], # A::C::Czech
46 SROMANOV => q[Сергей Романов], # A::C::Belarusian
47 VPIT => q[Vincent Pit], # A::C::You're_using
48 WOLDRICH => q[Magnus Woldrich], # A::C::Swedish
49 ZOFFIX => q[Zoffix Znet] # A::C::Canadian
50 1 );
51  
52 0 ▶sub _regen {
Subroutine _regen: not called CC=2 SCAR=17.9
53 0 require HTTP::Tiny;
54 0 my $data = '';
55 0 my $authsec = 0;
56 0 my %authors;
57 die "Failed\n"
58 unless HTTP::Tiny->new->request(
59 'GET',
60 'http://www.cpan.org/modules/02packages.details.txt',
61 0 ▶ {data_callback => sub { # Don't scrape the whole file
Subroutine __ANON__: not called CC=8 SCAR=42.8
62 0 my $chunk = shift;
63 0 ▶ if ($chunk =~ m[^Acme::CPANAuthors]sm) {
Branch: 2 branches
BranchTrueFalseTotal
if ($chunk =~ /^Acme::CPANAuthors/ms) { } 0 0 0
elsif ($authsec) { } 0 0 0
64 0 $authsec++;
65 0 $data .= $chunk;
66 }
67 elsif ($authsec) { # No more Authors in 02packages
68 0 ▶ while ($data
Branch: 1 branch
BranchTrueFalseTotal
if ($data =~ m[^(?:Acme::CPANAuthors(?:::(\S+))?).+\w/\w\w/(\w+)/.+$]gm) 0 0 0
69 =~ m[^(?:Acme::CPANAuthors(?:::(\S+))?).+\w/\w\w/(\w+)/.+$]mg
70 )
71 0 ▶ { $authors{$2} //= [];
Condition0%0/2
$authors{$2} //= []
l!l
00
MC/DC0%0/1
$authors{$2} //= []
$authors{$2}
Truth table0%0/2
A
A= $authors{$2}
Aresult
11
00
72 0 push @{$authors{$2}}, $1;
73 }
74 0 my %old = authors(); # Current authors
75 0 ▶ my @new = grep { defined $old{$_} ? () : $_ } keys %authors;
Branch: 1 branch
BranchTrueFalseTotal
defined $old{$_} ? : 0 0 0
76 0 print scalar(@new)
77 . " new Acme::CPANAuthors authors to add\n";
78 0 ▶ return if !@new;
Branch: 1 branch
BranchTrueFalseTotal
unless @new 0 0 0
79 0 require MetaCPAN::API;
80 0 my $mcpan = MetaCPAN::API->new();
81 0 binmode(STDOUT, ':utf8');
82  
83 0 for my $id (sort @new) {
84 0 my $author = $mcpan->author($id);
85 printf " %s => q[%s], # %s\n", $id, $author->{name},
86 0 join ', ', map { 'A::C::' . $_ } @{$authors{$id}};
87 }
88 exit # We're done
89 0 }
90 }
91 }
92 0 ▶ )->{success};
Branch: 1 branch
BranchTrueFalseTotal
unless "HTTP::Tiny"->new->request("GET", "http://www.cpan.org/modules/02packages.details.txt", {"data_callback", sub { my $chunk = shift(); if ($chunk =~ /^Acme::CPANAuthors/ms) { ++$authsec; $data .= $chunk; } elsif ($authsec) { while ($data =~ m[^(?:Acme::CPANAuthors(?:::(\S+))?).+\w/\w\w/(\w+)/.+$]gm) { $authors{$2} //= []; push @{$authors{$2};}, $1; } ; my(%old) = authors(); my(@new) = grep({defined $old{$_} ? () : $_;} keys %authors); print scalar(@new) . " new Acme::CPANAuthors authors to add\n"; return unless @new; require MetaCPAN::API; my $mcpan = "MetaCPAN::API"->new; binmode STDOUT, ":utf8"; foreach my $id (sort @new) { my $author = $mcpan->author($id); printf " %s => q[%s], # %s\n", $id, $author->{"name"}, join(", ", map({'A::C::' . $_;} @{$authors{$id};})); } ; exit; } ; } })->{"success"} 0 0 0
93 }
94 1 1;
95  
96 =head1 Synopsis
97  
98 use Acme::CPANAuthors;
99  
100 my $authors = Acme::CPANAuthors->new('Acme::CPANAuthors::Acme::CPANAuthors::Authors');
101  
102 $number = $authors->count;
103 @ids = $authors->id;
104 @distros = $authors->distributions('ACALPINI');
105 $url = $authors->avatar_url('SHLOMIF');
106 $kwalitee = $authors->kwalitee('SANKO');
107  
108 =head1 Description
109  
110 This class provides a hash of Pause IDs/names of Acme::CPANAuthors::*
111 authorin' CPAN authors.
112  
113 I started this module because
114 L<Acme::CPANAuthors::UnitedStates|Acme::CPANAuthors::UnitedStates> doesn't
115 exist and apparently I'm not listed in
116 L<Acme::CPANAuthors::Japanese|Acme::CPANAuthors::Japanese>. ((sigh)) I just
117 want to be a part of something... great... greater... than-- um, sorry, lost
118 my train of thought.
119  
120 Anyway, I decided both L<Acme::CPANAuthors::Earth|Acme::CPANAuthors::Earth>
121 (well covered between http://search.cpan.org/author/ and
122 http://pause.perl.org/pause/query?ACTION=who_is) and
123 L<Acme::CPANAuthors::Authors|Acme::CPANAuthors::Authors> (only include authors
124 who have published at least one distribution, script, etc.) would just be too
125 time consuming for a 3AM lapse in judgement so... there you are.
126  
127 =head1 Installation
128  
129 To install this module, run the following commands:
130  
131 perl Build.PL
132 ./Build
133 ./Build test
134 ./Build install
135  
136 =head1 Maintenance
137  
138 Have you authored a module in the C<Acme::CPANAuthors> namespace, aren't
139 listed here, and would like to be? Or are you currently listed but have since
140 turned away from your deviant, C<Acme> ways and would like to be removed? Just
141 contact me L<via email|/"AUTHOR"> or stop by the Issue Tracker and I'll fix ya
142 right up.
143  
144 =head1 Bugs
145  
146 Report any bugs or feature requests to the Issue tracker or
147 directly to L<me via email|/"AUTHOR">. I'll keep you up to date on any related
148 changes.
149  
150 Seriously, it's just a list of names... what could possibly go wrong?
151  
152 E<lt>_E<lt>
153  
154 E<gt>_E<gt>
155  
156 Yeah.
157  
158 =head1 Support
159  
160 You can find documentation for this module with the perldoc command.
161  
162 perldoc Acme::CPANAuthors::Acme::CPANAuthors::Authors
163  
164 You can also look for information at:
165  
166 =over 4
167  
168 =item * Issue Tracker: Acme::CPANAuthors::Acme::CPANAuthors::Authors' bug tracker
169  
170 http://github.com/sanko/acme-cpanauthors-acme-cpanauthors-authors/issues/
171  
172 =item * AnnoCPAN: Annotated CPAN documentation
173  
174 http://annocpan.org/dist/Acme-CPANAuthors-Acme-CPANAuthors-Authors
175  
176 =item * CPAN Ratings
177  
178 http://cpanratings.perl.org/d/Acme-CPANAuthors-Acme-CPANAuthors-Authors
179  
180 =item * Search CPAN
181  
182 http://search.cpan.org/dist/Acme-CPANAuthors-Acme-CPANAuthors-Authors
183  
184 =item * Version Control Repository:
185  
186 http://github.com/sanko/acme-cpanauthors-acme-cpanauthors-authors/
187  
188 =back
189  
190 =head1 See Also
191  
192 L<Acme::CPANAuthors|Acme::CPANAuthors>,
193 L<Acme::CPANAuthors::Japanese|Acme::CPANAuthors::Japanese>,
194 L<Acme::CPANAuthors::Misanthrope|Acme::CPANAuthors::Misanthrope>,
195 L<Acme::CPANAuthors::Not|Acme::CPANAuthors::Not>, et al.
196  
197 See the examples found in F</scripts/> for usage.
198  
199 =head1 Acknowledgements
200  
201 Kenichi Ishigaki for L<Acme::CPANAuthors|Acme::CPANAuthors>
202  
203 =head1 Author
204  
205 Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
206  
207 CPAN ID: SANKO
208  
209 =head1 License and Legal
210  
211 Copyright (C) 2009-2013 by Sanko Robinson E<lt>sanko@cpan.orgE<gt>
212  
213 This program is free software; you can redistribute it and/or modify
214 it under the terms of The Artistic License 2.0. See the F<LICENSE>
215 file included with this distribution or
216 http://www.perlfoundation.org/artistic_license_2_0. For
217 clarification, see http://ww.perlfoundation.org/artistic_2_0_notes.
218  
219 When separated from the distribution, all POD documentation is covered
220 by the Creative Commons Attribution-Share Alike 3.0 License. See
221 http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For
222 clarification, see http://creativecommons.org/licenses/by-sa/3.0/us/.
223  
224 =cut
↑ Summary