line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Format::Validate::URN; |
2
|
|
|
|
|
|
|
our $VERSION = q/0.3/; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
67860
|
use Carp; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
43
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
169
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
8
|
|
|
|
|
|
|
looks_like_urn |
9
|
|
|
|
|
|
|
/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
q/all/ => [qw/ |
13
|
|
|
|
|
|
|
looks_like_urn |
14
|
|
|
|
|
|
|
/] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub looks_like_urn ($) { |
18
|
|
|
|
|
|
|
|
19
|
13
|
|
|
13
|
0
|
96
|
my $urn = shift; |
20
|
13
|
|
|
|
|
80
|
$urn =~ /^ |
21
|
|
|
|
|
|
|
urn: # URN indicator |
22
|
|
|
|
|
|
|
[A-Z0-9] # First caracter (must be alphanumeric) |
23
|
|
|
|
|
|
|
[A-Z0-9-]{0,31}: # First word in URN (max of 32 caracters) |
24
|
|
|
|
|
|
|
[-A-Z0-9()+,\\.:=@;\$_!*'%\/?#]+ # Rest of URN (almost any caracters) |
25
|
|
|
|
|
|
|
$/ix |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding utf8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Data::Format::Validate - A URN validating module. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Function-oriented module capable of validating the format of any URN. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 UTILITIES |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=over 4 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item URN |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Data::Format::Validate::URN 'looks_like_urn'; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
looks_like_urn 'urn:oid:2.16.840'; # returns 1 |
50
|
|
|
|
|
|
|
looks_like_urn 'This is not a valid URN'; # returns 0 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 CONTRIBUITION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This source is on Github: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
https://github.com/rozcovo/Data-Format-Validate/blob/master/lib/Data/Format/Validate/URN.pm |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Created by Israel Batista |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |