line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V4::Node::Related; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
116
|
use Carp; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
1155
|
|
4
|
14
|
|
|
14
|
|
6951
|
use URI; |
|
14
|
|
|
|
|
57703
|
|
|
14
|
|
|
|
|
461
|
|
5
|
|
|
|
|
|
|
|
6
|
14
|
|
|
14
|
|
119
|
use Moose; |
|
14
|
|
|
|
|
39
|
|
|
14
|
|
|
|
|
132
|
|
7
|
14
|
|
|
14
|
|
99170
|
use Moose::Util::TypeConstraints; |
|
14
|
|
|
|
|
41
|
|
|
14
|
|
|
|
|
308
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Text::vCard::Precisely::V4::Node'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( is => 'ro', default => 'RELATED', isa => 'Str' ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
subtype 'RelatedType' => as 'Str' => where { |
14
|
|
|
|
|
|
|
m/^(?:contact|acquaintance|friend|met|co-worker|colleague|co-resident|neighbor|child|parent|sibling|spouse|kin|muse|crush|date|sweetheart|me|agent|emergency)$/is; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# it needs tests |
17
|
|
|
|
|
|
|
} => message {"The text you provided, $_, was not supported in 'RelatedType'"}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
subtype 'RelatedTypes' => as 'ArrayRef[RelatedType]'; |
20
|
|
|
|
|
|
|
coerce 'RelatedTypes' => from 'RelatedType' => via { [$_] }; |
21
|
|
|
|
|
|
|
has types => |
22
|
|
|
|
|
|
|
( is => 'rw', isa => 'RelatedTypes', default => sub { [] }, required => 1, coerce => 1 ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
override 'as_string' => sub { |
25
|
|
|
|
|
|
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
my @lines; |
27
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
28
|
|
|
|
|
|
|
push @lines, 'ALTID=' . $self->altID() if $self->altID(); |
29
|
|
|
|
|
|
|
push @lines, 'PID=' . join ',', @{ $self->pid() } if $self->pid(); |
30
|
|
|
|
|
|
|
push @lines, 'TYPE="' . join( ',', map { uc $_ } @{ $self->types() } ) . '"' |
31
|
|
|
|
|
|
|
if ref $self->types() eq 'ARRAY' and $self->types()->[0]; |
32
|
|
|
|
|
|
|
push @lines, "MEDIATYPE=" . $self->media_type() if defined $self->media_type(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . ':' . $self->content(); |
35
|
|
|
|
|
|
|
return $self->fold( $string, -force => 1 ); |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
14
|
|
|
14
|
|
37494
|
no Moose; |
|
14
|
|
|
|
|
38
|
|
|
14
|
|
|
|
|
135
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |