line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
25142
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
3
|
|
|
|
|
|
|
package SeeAlso::Identifier::ISIL; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$SeeAlso::Identifier::ISIL::VERSION = '0.71'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
#ABSTRACT: International Standard Identifier for Libraries and Related Organisations |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
22
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
4
|
use base qw( SeeAlso::Identifier Exporter ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
335
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = qw( sigel2isil ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
3
|
|
|
3
|
1
|
5
|
my $value = shift; |
20
|
|
|
|
|
|
|
|
21
|
3
|
50
|
|
|
|
8
|
if (defined $value) { |
22
|
3
|
|
|
|
|
13
|
$value =~ s/^\s+|\s+$//g; |
23
|
3
|
|
|
|
|
9
|
$value =~ s/^ISIL |^info:isil\///i; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ISIL too long |
26
|
3
|
50
|
|
|
|
8
|
return '' unless length($value) <= 16; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Does not look like an ISIL |
29
|
3
|
50
|
|
|
|
19
|
return '' unless $value =~ /^([A-Z0-9]+)-(.+)$/; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
8
|
my ($prefix, $local) = ($1, $2); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Invalid prefix |
34
|
3
|
50
|
33
|
|
|
13
|
return '' unless ($prefix =~ /^[A-Z]{2}$/ or |
35
|
|
|
|
|
|
|
$prefix =~ /^[A-Z0-9]([A-Z0-9]{1-3})?$/); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Invalid characters in local library identifier |
38
|
3
|
50
|
|
|
|
14
|
return '' unless ($local =~ /^[a-zA-Z0-9:\/-]+$/); |
39
|
|
|
|
|
|
|
} else { |
40
|
0
|
|
|
|
|
0
|
$value = ''; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
23
|
return $value; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub canonical { |
50
|
1
|
50
|
|
1
|
1
|
17
|
return ${$_[0]} eq '' ? '' : 'info:isil/' . uc(${$_[0]}); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
7
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub hash { |
55
|
1
|
50
|
|
1
|
1
|
2
|
return ${$_[0]} eq '' ? '' : uc(${$_[0]}); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub prefix { |
60
|
0
|
0
|
|
0
|
1
|
0
|
return ${$_[0]} =~ /^([A-Z0-9]+)-(.+)$/ ? $1 : ''; |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub local { |
65
|
0
|
0
|
|
0
|
1
|
0
|
return ${$_[0]} =~ /^([A-Z0-9]+)-(.+)$/ ? $2 : ''; |
|
0
|
|
|
|
|
0
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub sigel2isil { |
70
|
1
|
|
|
1
|
1
|
3
|
my $sigel = shift; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Falls das Sigel mit einem Buchstaben beginnt, |
73
|
|
|
|
|
|
|
# wird dieser in einen Großbuchstaben umgewandelt |
74
|
1
|
|
|
|
|
9
|
my $isil = ucfirst($sigel); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Bindestriche und Leerzeichen werden entfernt |
77
|
1
|
|
|
|
|
7
|
$isil =~ s/[- ]//g; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Slashes werden Bindestriche |
80
|
1
|
|
|
|
|
4
|
$isil =~ s/\//-/g; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Umlaute und Eszett (Ä,Ö,Ü,ä,ö,ü,ß) werden durch |
83
|
|
|
|
|
|
|
# einfache Buchstaben ersetzen (AE,ÖE,UE,ae,oe,ue,ss). |
84
|
1
|
|
|
|
|
2
|
$isil =~ s/Ä/AE/g; |
85
|
1
|
|
|
|
|
2
|
$isil =~ s/Ö/OE/g; |
86
|
1
|
|
|
|
|
1
|
$isil =~ s/Ü/UE/g; |
87
|
1
|
|
|
|
|
2
|
$isil =~ s/ä/ae/g; |
88
|
1
|
|
|
|
|
3
|
$isil =~ s/ö/oe/g; |
89
|
1
|
|
|
|
|
2
|
$isil =~ s/ü/ue/g; |
90
|
1
|
|
|
|
|
2
|
$isil =~ s/ß/ss/g; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
5
|
return SeeAlso::Identifier::ISIL->new("DE-$isil"); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=pod |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 NAME |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
SeeAlso::Identifier::ISIL - International Standard Identifier for Libraries and Related Organisations |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 VERSION |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
version 0.71 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 DESCRIPTION |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
The purpose of ISIL is to define and promote the use of a set of |
113
|
|
|
|
|
|
|
standard identifiers for the unique identification of libraries |
114
|
|
|
|
|
|
|
and related organizations with a minimum impact on already existing |
115
|
|
|
|
|
|
|
systems. ISILs are mostly based on existing MARC Organisation Codes |
116
|
|
|
|
|
|
|
(also known as National Union Catalogue symbols (NUC)) or similar |
117
|
|
|
|
|
|
|
existing identifiers. ISIL is defined in ISO 15511:2003. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The ISIL is a variable length identifier. The ISIL consists of a maximum |
120
|
|
|
|
|
|
|
of 16 characters, using digits (arabic numerals 0 to 9), unmodified letters |
121
|
|
|
|
|
|
|
from the basic latin alphabet and the special marks solidus (/), |
122
|
|
|
|
|
|
|
hyphen-minus (-) and colon (:). An ISIL is made up by two components: |
123
|
|
|
|
|
|
|
a prefix and a library identifier, in that order, separated by a hyphen-minus. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
ISIL prefixes are managed by the ISIL Registration Authority |
126
|
|
|
|
|
|
|
at http://www.bs.dk/isil/ . An ISIL prefix can either be a |
127
|
|
|
|
|
|
|
country code or a non country-code. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
A country code identifies the country in which the library or |
130
|
|
|
|
|
|
|
related organization is located at the time the ISIL is assigned. |
131
|
|
|
|
|
|
|
The country code shall consist of two uppercase letters in |
132
|
|
|
|
|
|
|
accordance with the codes specified in ISO 3166-1. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
A non-country code prefix is any combination of Latin alphabet |
135
|
|
|
|
|
|
|
characters (upper or lower case) or digits (but not special marks). |
136
|
|
|
|
|
|
|
The prefix may be one, three, or four characters in length. |
137
|
|
|
|
|
|
|
The prefix is registered at a global level with the ISIL |
138
|
|
|
|
|
|
|
Registration Authority. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 METHODS |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 parse ( [ $value ] ) |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Get and/or set the value of the ISIL. The ISIL must consist of a |
145
|
|
|
|
|
|
|
prefix and a local library identifier seperated by hypen-minus (-). |
146
|
|
|
|
|
|
|
Additionally it can be preceeded by "ISIL ". |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
The method returns '' or the valid, normalized ISIL. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 canonical ( ) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Because of lower/uppercase differences, two ISIL variants |
153
|
|
|
|
|
|
|
that only differ in case, may not be normalized to the same string. |
154
|
|
|
|
|
|
|
The 'canonical' method returns an all-upercase representation of ISIL. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 hash ( ) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Returns a version of ISIL to be used for indexing. This is an |
159
|
|
|
|
|
|
|
uppercase string because two ISIL must not differ only in case. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 prefix |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns the ISIL prefix. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 local |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns the local library identifier. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 UTILITY FUNCTIONS |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 sigel2isil ( $sigel ) |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Creates an ISIL from an old German library identifier ("Sigel"). This |
174
|
|
|
|
|
|
|
function is only a heuristic, not all cases can be mapped automatically! |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 NOTES |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
We could add validity check on prefixes with an additional prefix list. |
179
|
|
|
|
|
|
|
Note the usage of ISO 3166-2:1998 codes is only a recommendation in |
180
|
|
|
|
|
|
|
ISO 15511:2003. Moreover some country subdivision have changed since |
181
|
|
|
|
|
|
|
1998 and National ISIL Agencies may have other reasons not to use the |
182
|
|
|
|
|
|
|
same codes as provided by L. You can find a list |
183
|
|
|
|
|
|
|
of prefixes in the source code of this package. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 AUTHOR |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Jakob Voss |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Jakob Voss. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
194
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
__END__ |