line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V3::Node::URL; |
2
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
246
|
use Carp; |
|
28
|
|
|
|
|
81
|
|
|
28
|
|
|
|
|
2446
|
|
4
|
28
|
|
|
28
|
|
212
|
use URI; |
|
28
|
|
|
|
|
66
|
|
|
28
|
|
|
|
|
823
|
|
5
|
|
|
|
|
|
|
|
6
|
28
|
|
|
28
|
|
182
|
use Moose; |
|
28
|
|
|
|
|
77
|
|
|
28
|
|
|
|
|
291
|
|
7
|
28
|
|
|
28
|
|
185185
|
use Moose::Util::TypeConstraints; |
|
28
|
|
|
|
|
89
|
|
|
28
|
|
|
|
|
321
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Text::vCard::Precisely::V3::Node'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( is => 'ro', default => 'URL', isa => 'Str' ); |
12
|
|
|
|
|
|
|
has types => ( is => 'rw', isa => 'Types', coerce => 1 ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
subtype 'URL' => as 'Str'; |
15
|
|
|
|
|
|
|
coerce 'URL' => from 'Str' => via { [ URI->new($_)->as_string() ] }; |
16
|
|
|
|
|
|
|
has content => ( is => 'ro', default => '', isa => 'URL', coerce => 1 ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
override 'as_string' => sub { |
19
|
|
|
|
|
|
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
my @lines; |
21
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
22
|
|
|
|
|
|
|
push @lines, 'ALTID=' . $self->altID() if $self->can('altID') and $self->altID(); |
23
|
|
|
|
|
|
|
push @lines, 'PID=' . join ',', @{ $self->pid() } if $self->can('pid') and $self->pid(); |
24
|
|
|
|
|
|
|
push @lines, 'TYPE=' . join ',', map {uc} @{ $self->types() } |
25
|
|
|
|
|
|
|
if ref $self->types() eq 'ARRAY' and $self->types()->[0]; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . ':' . $self->content(); |
28
|
|
|
|
|
|
|
return $self->fold( $string, -force => 1 ); |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
32
|
28
|
|
|
28
|
|
65954
|
no Moose; |
|
28
|
|
|
|
|
77
|
|
|
28
|
|
|
|
|
180
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |