ImpactFactor.pm

filter: Statementstmt 35.3% 23 / 65 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 3 totaltotal 28.8% 30 / 104 SCAR 49.2
CC
17
Cov
25%
BUILD
132.0
search_by_name
20.0
search_by_issn
20.0
CRAP 137.6
↑ Summary JournalEntry.pm »
1 package Journal::ImpactFactor;
2  
3 1 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Journal::JournalEntry;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Journal::ImpactFactor - A list of updated scientiffic journal impact factor.
14  
15 =head1 VERSION
16  
17 Version 0.02
18  
19 =cut
20  
21 1 our $VERSION = '0.02';
22  
23  
24 =head1 SYNOPSIS
25  
26 Quick summary of what the module does.
27  
28 use Journal::ImpactFactor;
29  
30 # instantiate the journal list
31 my $if = Journal::ImpactFactor->new();
32  
33 # search a jounal by name
34 my $result = $if->search_by_name("Animal");
35
36 # search a journal by issn
37 my $resul = $if->search_by_issn('0718-7106');
38
39 # print the impact factor for the year 2010
40 say $result->year_2010;
41 ...
42  
43 =head1 DESCRIPTION
44  
45 This module provides access to impact factor information of 1100 different scientific journals. You can access data from 2008 to 2013/2014. All data compiled here is from public domain.
46  
47 =head2 Methods
48  
49 =head3 search by name
50  
51 This method sreturns a JournalEntry object (see methods below).
52  
53 my $result = $if->search_by_name("name");
54  
55 =head3 search by issn
56  
57 This method sreturns a JournalEntry object (see methods below).
58  
59 my $resul = $if->search_by_issn("issn");
60  
61 =head3 name
62  
63 say $result->name;
64  
65 =head3 issn
66  
67 say $result->issn;
68  
69 =head3 year_2008
70  
71 say $result->year_2008;
72  
73 =head3 year_2009
74  
75 say $result->year_2009;
76  
77 =head3 year_2010
78  
79 say $result->year_2010;
80  
81 =head3 year_2011
82  
83 say $result->year_2011;
84  
85 =head3 year_2012
86  
87 say $result->year_2012;
88  
89 =head3 year_2013_2014
90  
91 say $result->year_2013_2014;
92  
93 =cut
94  
95 1 has 'journal_list' => (
96 is => 'rw',
97 isa => 'ArrayRef[Journal::JournalEntry]',
98 );
99  
100  
101 sub BUILD {
102 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=11 SCAR=48.8
Pod undocumented
103  
104 0 ▶ my $hashref = retrieve('journals') or die "[Error]: Could not find journal list";
Branch: 1 branch
BranchTrueFalseTotal
my $hashref = retrieve("journals") or die "[Error]: Could not find journal list" 0 0 0
105 0 my %journals = %{$hashref};
106  
107 0 my $j;
108 my @list;
109  
110 0 for my $key ( keys %journals ) {
111
112 0 $j = Journal::JournalEntry->new();
113  
114 0 my @line = split(/\t/, $journals{$key});
115
116 0 ▶ $j->name($line[0]) if defined ($line[0]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[0] 0 0 0
117 0 ▶ $j->issn($line[1]) if defined ($line[1]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[1] 0 0 0
118 0 ▶ $j->year_2008($line[2]) if defined ($line[2]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[2] 0 0 0
119 0 ▶ $j->year_2009($line[3]) if defined ($line[3]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[3] 0 0 0
120 0 ▶ $j->year_2010($line[4]) if defined ($line[4]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[4] 0 0 0
121 0 ▶ $j->year_2011($line[5]) if defined ($line[5]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[5] 0 0 0
122 0 ▶ $j->year_2012($line[6]) if defined ($line[6]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[6] 0 0 0
123 0 ▶ $j->year_2013_2014($line[7]) if defined ($line[7]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $line[7] 0 0 0
124  
125 0 push(@list, $j);
126 }
127  
128 0 $self->journal_list(\@list);
129 }
130  
131 sub search_by_name {
132 0 ▶ my $self = shift;
Subroutine search_by_name: not called CC=4 SCAR=30.0
Pod undocumented
133 0 my $name = shift;
134  
135 0 my @list = @{$self->journal_list};
136  
137 0 my $result;
138  
139 0 for my $j ( @list ) {
140  
141 0 ▶ if ( $j->name =~ m/^$name$/ig ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j->name =~ /^$name$/giu) 0 0 0
142
143 0 $result = $j;
144 }
145 }
146  
147 0 ▶ if ($result) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result) { } 0 0 0
148
149 0 return $result;
150  
151 } else {
152
153 0 say "Journal not found";
154 0 return undef;
155  
156 }
157  
158 }
159  
160  
161 sub search_by_issn {
162 0 ▶ my $self = shift;
Subroutine search_by_issn: not called CC=4 SCAR=30.0
Pod undocumented
163 0 my $issn = shift;
164  
165 0 my @list = @{$self->journal_list};
166  
167 0 my $result;
168  
169 0 for my $j ( @list ) {
170  
171 0 ▶ if ( $j->issn =~ m/^$issn$/ig ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j->issn =~ /^$issn$/giu) 0 0 0
172
173 0 $result = $j;
174 }
175 }
176  
177 0 ▶ if ($result) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result) { } 0 0 0
178
179 0 return $result;
180  
181 } else {
182
183 0 say "Journal not found";
184 0 return undef;
185  
186 }
187  
188 }
189  
190  
191  
192  
193 =head1 AUTHOR
194  
195 Felipe da Veiga Leprevost, C<< <leprevost at cpan.org> >>
196  
197 =head1 BUGS
198  
199 Please report any bugs or feature requests to C<bug-journal-impactfactor at rt.cpan.org>, or through
200 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Journal-ImpactFactor>. I will be notified, and then you'll
201 automatically be notified of progress on your bug as I make changes.
202  
203  
204  
205  
206 =head1 SUPPORT
207  
208 You can find documentation for this module with the perldoc command.
209  
210 perldoc Journal::ImpactFactor
211  
212  
213 You can also look for information at:
214  
215 =over 4
216  
217 =item * RT: CPAN's request tracker (report bugs here)
218  
219 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Journal-ImpactFactor>
220  
221 =item * AnnoCPAN: Annotated CPAN documentation
222  
223 L<http://annocpan.org/dist/Journal-ImpactFactor>
224  
225 =item * CPAN Ratings
226  
227 L<http://cpanratings.perl.org/d/Journal-ImpactFactor>
228  
229 =item * Search CPAN
230  
231 L<http://search.cpan.org/dist/Journal-ImpactFactor/>
232  
233 =back
234  
235  
236 =head1 ACKNOWLEDGEMENTS
237  
238  
239 =head1 LICENSE AND COPYRIGHT
240  
241 Copyright 2014 Felipe da Veiga Leprevost.
242  
243 This program is free software; you can redistribute it and/or modify it
244 under the terms of the the Artistic License (2.0). You may obtain a
245 copy of the full license at:
246  
247 L<http://www.perlfoundation.org/artistic_license_2_0>
248  
249 Any use, modification, and distribution of the Standard or Modified
250 Versions is governed by this Artistic License. By using, modifying or
251 distributing the Package, you accept this license. Do not use, modify,
252 or distribute the Package, if you do not accept this license.
253  
254 If your Modified Version has been derived from a Modified Version made
255 by someone other than you, you are nevertheless required to ensure that
256 your Modified Version complies with the requirements of this license.
257  
258 This license does not grant you the right to use any trademark, service
259 mark, tradename, or logo of the Copyright Holder.
260  
261 This license includes the non-exclusive, worldwide, free-of-charge
262 patent license to make, have made, use, offer to sell, sell, import and
263 otherwise transfer the Package with respect to any patent claims
264 licensable by the Copyright Holder that are necessarily infringed by the
265 Package. If you institute patent litigation (including a cross-claim or
266 counterclaim) against any party alleging that the Package constitutes
267 direct or contributory patent infringement, then this Artistic License
268 to you shall terminate on the date that such litigation is filed.
269  
270 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
271 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
272 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
273 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
274 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
275 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
276 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
277 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
278  
279  
280 =cut
281  
282 1 1; # End of Journal::ImpactFactor
↑ Summary JournalEntry.pm »