line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V4::Node::Member; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
114
|
use Carp; |
|
14
|
|
|
|
|
39
|
|
|
14
|
|
|
|
|
1157
|
|
4
|
14
|
|
|
14
|
|
95
|
use Moose; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
118
|
|
5
|
14
|
|
|
14
|
|
96592
|
use Moose::Util::TypeConstraints; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
143
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Text::vCard::Precisely::V4::Node'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has name => ( is => 'ro', default => 'MEMBER', isa => 'Str' ); |
10
|
|
|
|
|
|
|
has content => ( is => 'ro', default => '', isa => 'Str' ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
subtype 'MemberType' => as 'Str' => where { |
13
|
|
|
|
|
|
|
m/^(?:contact|acquaintance|friend|met|co-worker|colleague|co-resident|neighbor|child|parent|sibling|spouse|kin|muse|crush|date|sweetheart|me|agent|emergency)$/is; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# it needs tests |
16
|
|
|
|
|
|
|
} => message {"The text you provided, $_, was not supported in 'MemberType'"}; |
17
|
|
|
|
|
|
|
has types => ( is => 'rw', isa => 'ArrayRef[MemberType]', default => sub { [] } ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
override 'as_string' => sub { |
20
|
|
|
|
|
|
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
my @lines; |
22
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
23
|
|
|
|
|
|
|
push @lines, 'ALTID=' . $self->altID() if $self->altID(); |
24
|
|
|
|
|
|
|
push @lines, 'PID=' . join ',', @{ $self->pid() } if $self->pid(); |
25
|
|
|
|
|
|
|
push @lines, 'TYPE="' . join( ',', map { uc $_ } @{ $self->types() } ) . '"' |
26
|
|
|
|
|
|
|
if ref $self->types() eq 'ARRAY' and $self->types()->[0]; |
27
|
|
|
|
|
|
|
push @lines, 'PREF=' . $self->pref() if $self->pref(); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . ':' . $self->_escape( $self->content() ); |
30
|
|
|
|
|
|
|
return $self->fold($string); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
14
|
|
|
14
|
|
37822
|
no Moose; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
90
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |