line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
23305
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
3
|
|
|
|
|
|
|
package SeeAlso::Identifier::GND; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$SeeAlso::Identifier::GND::VERSION = '0.71'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
#ABSTRACT: Identifier of the GND Authority File |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
604
|
use SeeAlso::Identifier; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
11
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
7
|
use base qw( SeeAlso::Identifier ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
625
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
4
|
|
|
4
|
1
|
881
|
my $class = shift; |
18
|
4
|
|
|
|
|
13
|
my $self = bless { }, $class; |
19
|
4
|
|
100
|
|
|
19
|
$self->value( shift || "" ); |
20
|
4
|
|
|
|
|
11
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub value { |
25
|
24
|
|
|
24
|
1
|
7836
|
my $self = shift; |
26
|
24
|
|
|
|
|
34
|
my $value = shift; |
27
|
|
|
|
|
|
|
|
28
|
24
|
100
|
|
|
|
60
|
if (defined $value) { |
29
|
23
|
|
|
|
|
93
|
$value =~ s/^\s+|\s+$//; |
30
|
23
|
|
|
|
|
83
|
$value =~ s/^http:\/\/d-nb.info\/gnd\/|(GND|pnd|SWD|GKD|EST)\s*//i; |
31
|
23
|
|
|
|
|
44
|
$value =~ s/^0+//; # zeros |
32
|
23
|
|
|
|
|
32
|
$value =~ s/-//g; |
33
|
23
|
|
|
|
|
139
|
$self->{value} = uc($value); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
24
|
|
|
|
|
52
|
return $self->{value}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub valid { |
41
|
44
|
|
|
44
|
1
|
82
|
my $self = shift; |
42
|
44
|
|
|
|
|
79
|
my $value = $self->{value}; |
43
|
|
|
|
|
|
|
|
44
|
44
|
100
|
|
|
|
197
|
return if $value !~ /^[0-9]*[0-9X]$/; |
45
|
41
|
50
|
|
|
|
94
|
return 1 if length($value) > 9; # new long GND |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# TODO: fix bad syntax |
48
|
41
|
50
|
|
|
|
78
|
if ($value) { # not on empty value |
49
|
41
|
|
|
|
|
109
|
for (my $i = 9-length($value);$i>0;$i--) { |
50
|
19
|
|
|
|
|
52
|
$value = "0$value"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
41
|
50
|
|
|
|
151
|
$value =~ /^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9X])$/ |
55
|
|
|
|
|
|
|
|| return; |
56
|
41
|
|
|
|
|
213
|
my $sum = $1*9 + $2*8 + $3*7 + $4*6 + $5*5 + $6*4 + $7*3 + $8*2; |
57
|
41
|
100
|
|
|
|
109
|
my $c = $9 eq 'X' ? 10 : $9; |
58
|
41
|
|
|
|
|
48
|
$sum %= 11; |
59
|
|
|
|
|
|
|
|
60
|
41
|
|
100
|
|
|
330
|
return ((((11 - $sum) % 11) eq $c) or ((11 - (11 - $sum) % 11) eq $c)); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub canonical { |
65
|
19
|
|
|
19
|
1
|
27
|
my $self = shift; |
66
|
19
|
100
|
|
|
|
35
|
return $self->valid() ? ("http://d-nb.info/gnd/" . $self->{value}) : ""; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub indexed { |
71
|
13
|
|
|
13
|
1
|
20
|
my $self = shift; |
72
|
13
|
100
|
|
|
|
28
|
return $self->valid ? $self->{value} : undef; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |