File Coverage

blib/lib/Journal/ImpactFactor.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Journal::ImpactFactor;
2              
3 1     1   14632 use v5.12;
  1         3  
  1         38  
4 1     1   4 use strict;
  1         5  
  1         30  
5 1     1   4 use warnings;
  1         5  
  1         21  
6 1     1   191 use Moose;
  0            
  0            
7             use namespace::autoclean;
8             use Storable;
9             use Journal::JournalEntry;
10              
11             =head1 NAME
12              
13             Journal::ImpactFactor - A list of updated scientiffic journal impact factor.
14              
15             =head1 VERSION
16              
17             Version 0.03
18              
19             =cut
20              
21             our $VERSION = '0.03';
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 www.citefactor.org.
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             has 'journal_list' => (
96             is => 'rw',
97             isa => 'ArrayRef[Journal::JournalEntry]',
98             );
99              
100              
101             sub BUILD {
102             my $self = shift;
103              
104             my $hashref = retrieve('journals') or die "[Error]: Could not find journal list";
105             my %journals = %{$hashref};
106              
107             my $j;
108             my @list;
109              
110             for my $key ( keys %journals ) {
111            
112             $j = Journal::JournalEntry->new();
113              
114             my @line = split(/\t/, $journals{$key});
115            
116             $j->name($line[0]) if defined ($line[0]);
117             $j->issn($line[1]) if defined ($line[1]);
118             $j->year_2008($line[2]) if defined ($line[2]);
119             $j->year_2009($line[3]) if defined ($line[3]);
120             $j->year_2010($line[4]) if defined ($line[4]);
121             $j->year_2011($line[5]) if defined ($line[5]);
122             $j->year_2012($line[6]) if defined ($line[6]);
123             $j->year_2013_2014($line[7]) if defined ($line[7]);
124              
125             push(@list, $j);
126             }
127              
128             $self->journal_list(\@list);
129             }
130              
131             sub search_by_name {
132             my $self = shift;
133             my $name = shift;
134              
135             my @list = @{$self->journal_list};
136              
137             my $result;
138              
139             for my $j ( @list ) {
140              
141             if ( $j->name =~ m/^$name$/ig ) {
142            
143             $result = $j;
144             }
145             }
146              
147             if ($result) {
148            
149             return $result;
150              
151             } else {
152            
153             say "Journal not found";
154             return undef;
155              
156             }
157              
158             }
159              
160              
161             sub search_by_issn {
162             my $self = shift;
163             my $issn = shift;
164              
165             my @list = @{$self->journal_list};
166              
167             my $result;
168              
169             for my $j ( @list ) {
170              
171             if ( $j->issn =~ m/^$issn$/ig ) {
172            
173             $result = $j;
174             }
175             }
176              
177             if ($result) {
178            
179             return $result;
180              
181             } else {
182            
183             say "Journal not found";
184             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; # End of Journal::ImpactFactor