|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Logfile::EPrints::Mapping::arXiv;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
33
 | 
 use strict;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
202
 | 
    | 
| 
4
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
28
 | 
 use warnings;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
153
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
30
 | 
 use URI;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3666
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
9
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
0
  
 | 
73
 | 
 	my ($class,%args) = @_;  | 
| 
10
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
 	bless \%args, $class;  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub hit {  | 
| 
14
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
0
  
 | 
6
 | 
 	my ($self,$hit) = @_;  | 
| 
15
 | 
2
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
16
 | 
 	if( !defined($hit->code) or $hit->code =~ /\D/ )  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	{  | 
| 
17
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		Carp::carp("No or invalid response code for: ".$hit->{raw});  | 
| 
18
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		return;  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
20
 | 
2
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
18
 | 
 	if( 'GET' eq $hit->method && 200 == $hit->code ) {  | 
| 
21
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
 		my $path = URI->new($hit->page,'http')->path;  | 
| 
22
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12578
 | 
 		$path =~ s/\/other//;  | 
| 
23
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
14
 | 
 		if( $path =~ /^\/((PS_cache)|(ftp))/ ) {  | 
| 
24
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 			$path =~ s/\/\w+\/\d{4}\//\//;  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
26
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
32
 | 
 		if( $path =~ /^\/(abs|pdf|ps|PS_cache|dvi|ftp|e-print)\/([A-Za-z\-\.]+)\/?([0-9]{7})/ ) {  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			my ($t,$i,$n) = ($1,$2,$3);  | 
| 
28
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			$i=~ s/(?<=\w)\.\w+$//;  | 
| 
29
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			$hit->{identifier} = 'oai:arXiv.org:'.$i.'/'.$n;  | 
| 
30
 | 
0
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			if( $t eq 'abs' ) {  | 
| 
31
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 				$self->{handler}->abstract($hit);  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			} else {  | 
| 
33
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
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
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
 			my( $type, $identifier ) = ($1,$2);  | 
| 
38
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
 			$hit->{identifier} = 'oai:arXiv.org:' . $identifier;  | 
| 
39
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
8
 | 
 			if( $type eq 'abs' ) {  | 
| 
40
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 				$self->{handler}->abstract($hit);  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			} else {  | 
| 
42
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
 				$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
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |