blib/lib/Keystone/Resolver/plugins/Citation/APP.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 85 CC 10 SCAR 45.2
CC
10
Cov
0%
citation
110.0
BEGIN
2.0
BEGIN
2.0
CRAP 92.0
1 # $Id: APP.pm,v 1.2 2007-01-26 13:53:47 mike Exp $
2  
3 package Keystone::Resolver::plugins::Citation::APP;
4  
5 use strict;
6 use warnings;
7  
8  
9 sub citation {
10 my $class = shift();
11 my($openurl) = @_;
12  
13 my($genre, $aulast, $auinit, $date, $atitle, $jtitle, $volume,
14 $spage, $epage, $btitle, $pub, $place)
15 = map { $openurl->rft($_) }
16 qw(genre aulast auinit date atitle jtitle volume spage
17 epage btitle pub place);
18  
19 $aulast ||= "[Unspecified author]";
20 $auinit ||= $openurl->rft("aufirst");
21 $date ||= "[unspecified date]";
22 $atitle ||= "[unspecified article title]";
23 $volume ||= "[unspecified volume]";
24  
25 my $name;
26 if (defined $auinit) {
27 $auinit =~ s/\.$//;
28 $name = "$aulast, $auinit";
29 } else {
30 $name = "$aulast";
31 }
32  
33 if (defined $genre && $genre eq "book") {
34 my $text = "$name. $date. $btitle.";
35 $text .= " $pub." if defined $pub;
36 $text .= " $place." if defined $place;
37 return ($text, "text/html");
38 }
39  
40 if (!defined $jtitle) {
41 my $issn = $openurl->rft("issn");
42 if (defined $issn) {
43 $jtitle = "ISSN $issn";
44 } else {
45 $jtitle = "[unspecified journal]";
46 }
47 }
48  
49 my $text = "$name. $date. $atitle. <i>$jtitle</i>, $volume";
50 if (defined $spage && defined $epage) {
51 $text .= ": $spage-$epage";
52 } elsif (defined $spage) {
53 $text .= ": $spage ff.";
54 } elsif (defined $epage) {
55 $text .= ": to $epage";
56 }
57  
58 return ("$text.", "text/html");
59 }
60  
61  
62 1;