line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UUID::Generator::PurePerl::Compat; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
972
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
95
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
121
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.02_01'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
10
|
use Exporter; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
155
|
|
9
|
|
|
|
|
|
|
*import = \&Exporter::import; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw( NameSpace_DNS NameSpace_URL NameSpace_OID NameSpace_X500 ); |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
10
|
use Carp; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
136
|
|
14
|
3
|
|
|
3
|
|
409
|
use UUID::Generator::PurePerl; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
53
|
|
15
|
3
|
|
|
3
|
|
10
|
use UUID::Object; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1815
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
1
|
|
|
1
|
1
|
28
|
my $class = shift; |
19
|
1
|
|
|
|
|
3
|
my $self = bless {}, $class; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
3
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub generator { |
25
|
17
|
|
|
17
|
0
|
17
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
17
|
100
|
|
|
|
35
|
if (! defined $self->{generator}) { |
28
|
1
|
|
|
|
|
6
|
$self->{generator} = UUID::Generator::PurePerl->new(); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
17
|
|
|
|
|
52
|
return $self->{generator}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _generate_v1 { |
35
|
6
|
|
|
6
|
|
9
|
my ($self, $type) = @_; |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
13
|
return $self->generator->generate_v1()->$type(); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub create_bin { |
41
|
3
|
|
|
3
|
1
|
776
|
my $self = shift; |
42
|
3
|
|
|
|
|
7
|
return $self->_generate_v1('as_binary_np', @_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
*create = *create_bin; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub create_str { |
47
|
1
|
|
|
1
|
0
|
1143
|
my $self = shift; |
48
|
1
|
|
|
|
|
4
|
return uc $self->_generate_v1('as_string', @_); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub create_hex { |
52
|
1
|
|
|
1
|
1
|
361
|
my $self = shift; |
53
|
1
|
|
|
|
|
4
|
return '0x' . uc $self->_generate_v1('as_hex', @_); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub create_b64 { |
57
|
1
|
|
|
1
|
1
|
364
|
my $self = shift; |
58
|
1
|
|
|
|
|
5
|
return $self->_generate_v1('as_base64_np', @_); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _generate_v3 { |
62
|
11
|
|
|
11
|
|
16
|
my ($self, $type, $ns, $name) = @_; |
63
|
|
|
|
|
|
|
|
64
|
11
|
|
|
|
|
37
|
$ns = UUID::Object->create_from_binary_np($ns); |
65
|
|
|
|
|
|
|
|
66
|
11
|
|
|
|
|
192
|
return $self->generator->generate_v3($ns, $name)->$type(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub create_from_name_bin { |
70
|
5
|
|
|
5
|
1
|
1767
|
my $self = shift; |
71
|
5
|
|
|
|
|
13
|
return uc $self->_generate_v3('as_binary_np', @_); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
*create_from_name = *create_from_name_bin; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub create_from_name_str { |
76
|
2
|
|
|
2
|
0
|
634
|
my $self = shift; |
77
|
2
|
|
|
|
|
6
|
return uc $self->_generate_v3('as_string', @_); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub create_from_name_hex { |
81
|
2
|
|
|
2
|
1
|
599
|
my $self = shift; |
82
|
2
|
|
|
|
|
4
|
return '0x' . uc $self->_generate_v3('as_hex', @_); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub create_from_name_b64 { |
86
|
2
|
|
|
2
|
1
|
623
|
my $self = shift; |
87
|
2
|
|
|
|
|
5
|
return $self->_generate_v3('as_base64_np', @_); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub to_string { |
92
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
93
|
1
|
|
|
|
|
4
|
return uc UUID::Object->create_from_binary_np(@_)->as_string; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub to_hexstring { |
97
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
98
|
1
|
|
|
|
|
4
|
return '0x' . uc UUID::Object->create_from_binary_np(@_)->as_hex; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub to_b64string { |
102
|
2
|
|
|
2
|
1
|
113
|
my $self = shift; |
103
|
2
|
|
|
|
|
5
|
return UUID::Object->create_from_binary_np(@_)->as_base64_np; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub from_string { |
107
|
1
|
|
|
1
|
1
|
17
|
my $self = shift; |
108
|
1
|
|
|
|
|
4
|
return UUID::Object->create_from_string(@_)->as_binary_np; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub from_hexstring { |
112
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
113
|
1
|
|
|
|
|
2
|
my $arg = shift; |
114
|
|
|
|
|
|
|
|
115
|
1
|
|
|
|
|
4
|
$arg =~ s{ \A 0x }{}ixmso; |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
|
|
4
|
return UUID::Object->create_from_hex($arg)->as_binary_np; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub from_b64string { |
121
|
1
|
|
|
1
|
1
|
22
|
my $self = shift; |
122
|
1
|
|
|
|
|
6
|
return UUID::Object->create_from_base64_np(@_)->as_binary_np; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub compare { |
127
|
3
|
|
|
3
|
1
|
890
|
my ($self, $a, $b) = @_; |
128
|
|
|
|
|
|
|
|
129
|
3
|
|
|
|
|
10
|
$a = UUID::Object->create_from_binary_np($a); |
130
|
3
|
|
|
|
|
44
|
$b = UUID::Object->create_from_binary_np($b); |
131
|
|
|
|
|
|
|
|
132
|
3
|
|
|
|
|
33
|
return $a cmp $b; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub NameSpace_DNS { |
137
|
1
|
|
|
1
|
1
|
421
|
return UUID::Object::uuid_ns_dns()->as_binary_np; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub NameSpace_URL { |
141
|
1
|
|
|
1
|
1
|
126
|
return UUID::Object::uuid_ns_url()->as_binary_np; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub NameSpace_OID { |
145
|
1
|
|
|
1
|
1
|
32
|
return UUID::Object::uuid_ns_oid()->as_binary_np; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub NameSpace_X500 { |
149
|
1
|
|
|
1
|
1
|
26
|
return UUID::Object::uuid_ns_x500()->as_binary_np; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |
153
|
|
|
|
|
|
|
__END__ |