EPrints/Mapping/arXiv.pm

filter: Statementstmt 68.5% 24 / 35 Branchbran 38.8% 7 / 18 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 54.2% 38 / 70 CC 12 SCAR 33.2
CC
12
Cov
56%
hit
36.4
BEGIN
1.0
BEGIN
1.0
CRAP 27.5
« EPrints/Filter/Period.pm ↑ Summary EPrints/Filter/Robots.pm »
1 package Logfile::EPrints::Mapping::arXiv;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 2 my ($class,%args) = @_;
10 2 bless \%args, $class;
11 }
12  
13 2 ▶sub hit {
Subroutine hit: called CC=12 SCAR=35.9
Pod undocumented
14 2 my ($self,$hit) = @_;
15 2 ▶ if( !defined($hit->code) or $hit->code =~ /\D/ )
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $hit->code or $hit->code =~ /\D/) 0 2 2
Condition33%1/3
not defined $hit->code or $hit->code =~ /\D/
l!l&&r!l&&!r
002
MC/DC0%0/2
not defined $hit->code or $hit->code =~ /\D/
not defined $hit->code $hit->code =~ /\D/
Truth table33%1/3
not(A) or B
A= not defined $hit->codeB= $hit->code =~ /\D/
ABresult
1X1
011
000
16 {
17 0 Carp::carp("No or invalid response code for: ".$hit->{raw});
18 0 return;
19 }
20 2 ▶ if( 'GET' eq $hit->method && 200 == $hit->code ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("GET" eq $hit->method and 200 == $hit->code) 2 0 2
Condition33%1/3
"GET" eq $hit->method and 200 == $hit->code
!ll&&!rl&&r
002
MC/DC0%0/2
"GET" eq $hit->method and 200 == $hit->code
"GET" eq $hit->method 200 == $hit->code
Truth table33%1/3
A and B
A= "GET" eq $hit->methodB= 200 == $hit->code
ABresult
0X0
100
111
21 2 my $path = URI->new($hit->page,'http')->path;
22 2 $path =~ s/\/other//;
23 2 ▶ if( $path =~ /^\/((PS_cache)|(ftp))/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m[^/((PS_cache)|(ftp))]) 1 1 2
24 1 $path =~ s/\/\w+\/\d{4}\//\//;
25 }
26 2 ▶ if( $path =~ /^\/(abs|pdf|ps|PS_cache|dvi|ftp|e-print)\/([A-Za-z\-\.]+)\/?([0-9]{7})/ ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($path =~ m[^/(abs|pdf|ps|PS_cache|dvi|ftp|e-print)/([A-Za-z\-\.]+)/?([0-9]{7})]) { } 0 2 2
elsif ($path =~ m[^/(abs|pdf|ps|PS_cache|dvi|ftp|e-print)/(?:arxiv/)?([0-9]{4}\.[0-9]{4,})]) { } 2 0 2
elsif ($path =~ m[^/list]) { } 0 0 0
elsif ($path =~ m[^/find]) { } 0 0 0
27 0 my ($t,$i,$n) = ($1,$2,$3);
28 0 $i=~ s/(?<=\w)\.\w+$//;
29 0 $hit->{identifier} = 'oai:arXiv.org:'.$i.'/'.$n;
30 0 ▶ if( $t eq 'abs' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t eq 'abs') { } 0 0 0
31 0 $self->{handler}->abstract($hit);
32 } else {
33 0 $self->{handler}->fulltext($hit);
34 }
35 # arXiv:0704.0021, introduced Apr 2007
36 } elsif( $path =~ /^\/(abs|pdf|ps|PS_cache|dvi|ftp|e-print)\/(?:arxiv\/)?([0-9]{4}\.[0-9]{4,})/ ) {
37 2 my( $type, $identifier ) = ($1,$2);
38 2 $hit->{identifier} = 'oai:arXiv.org:' . $identifier;
39 2 ▶ if( $type eq 'abs' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq 'abs') { } 0 2 2
40 0 $self->{handler}->abstract($hit);
41 } else {
42 2 $self->{handler}->fulltext($hit);
43 }
44 } elsif( $path =~ /^\/list/ ) {
45 0 $self->{handler}->browse($hit);
46 } elsif( $path =~ /^\/find/ ) {
47 0 $self->{handler}->search($hit);
48 # Index / Image requests / help
49 # Other requests:
50 # \/ = index
51 # ^\/icon|uk\.gif = images
52 # ^\/help = help pages
53 # ^\/form = browsing form
54 # ^\/css = stylesheets
55 # ^\/format = list available full-text formats
56 #} elsif( $path eq '/' || $path =~ /^\/(icon|help|form)|uk\.gif|robots.txt/) {
57 } else {
58 # warn "Unhandled request type: $path\n$hit->{raw}\n";
59 }
60 }
61 }
62  
63 # Autoload methods go after =cut, and are processed by the autosplit program.
64  
65 6 1;
66 __END__
« EPrints/Filter/Period.pm ↑ Summary EPrints/Filter/Robots.pm »