| 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
Condition33%1/3
not defined $hit->code or $hit->code =~ /\D/
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/
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
"GET" eq $hit->method and 200 == $hit->code
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||