line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cikl::Models::Address::url; |
2
|
2
|
|
|
2
|
|
14002
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
92
|
|
3
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
4
|
2
|
|
|
2
|
|
351
|
use Mouse; |
|
2
|
|
|
|
|
14721
|
|
|
2
|
|
|
|
|
17
|
|
5
|
2
|
|
|
2
|
|
1752
|
use Cikl::Models::AddressRole; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
1141
|
use Cikl::DataTypes::Url; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
73
|
|
7
|
2
|
|
|
2
|
|
14
|
use namespace::autoclean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
8
|
|
|
|
|
|
|
with 'Cikl::Models::AddressRole'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
232
|
use constant RE_URL_SCHEME => qr/^[-+.a-zA-Z0-9]+:\/\//; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
585
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
0
|
4
|
sub type { 'url' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+value' => ( |
15
|
|
|
|
|
|
|
isa => 'Cikl::DataTypes::Url', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub normalize_value { |
20
|
6
|
|
|
6
|
0
|
8
|
my $class = shift; |
21
|
6
|
|
|
|
|
10
|
my $url = shift; |
22
|
6
|
50
|
33
|
|
|
34
|
return $url unless ($url && ref($url) eq ''); |
23
|
6
|
|
|
|
|
16
|
$url =~ s/^\s+//; |
24
|
6
|
|
|
|
|
15
|
$url =~ s/\s+$//; |
25
|
6
|
100
|
|
|
|
72
|
if ($url !~ RE_URL_SCHEME) { |
26
|
|
|
|
|
|
|
# Default to 'http' if a scheme has not been specified. |
27
|
1
|
|
|
|
|
4
|
$url= "http://$url"; |
28
|
|
|
|
|
|
|
} |
29
|
6
|
|
|
|
|
26
|
my $uri_obj = URI->new($url)->canonical(); |
30
|
6
|
|
|
|
|
1827
|
$url = $uri_obj->as_string(); |
31
|
6
|
|
|
|
|
50
|
return $url; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|