line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V3::Node::N; |
2
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
7822
|
use Carp; |
|
28
|
|
|
|
|
67
|
|
|
28
|
|
|
|
|
1997
|
|
4
|
28
|
|
|
28
|
|
166
|
use Moose; |
|
28
|
|
|
|
|
64
|
|
|
28
|
|
|
|
|
182
|
|
5
|
28
|
|
|
28
|
|
174287
|
use Moose::Util::TypeConstraints; |
|
28
|
|
|
|
|
67
|
|
|
28
|
|
|
|
|
269
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Text::vCard::Precisely::V3::Node'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my @order = qw( family given additional prefixes suffixes ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( is => 'ro', default => 'N', isa => 'Str' ); |
12
|
|
|
|
|
|
|
has \@order => ( is => 'rw', isa => 'Str|Undef', default => undef ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
subtype 'Values' => as 'HashRef[Maybe[Str]]'; |
15
|
|
|
|
|
|
|
coerce 'Values', from 'ArrayRef[Maybe[Str]]', via { |
16
|
|
|
|
|
|
|
my @values = @$_; |
17
|
|
|
|
|
|
|
$values[4] ||= ''; |
18
|
|
|
|
|
|
|
my $hash = {}; |
19
|
|
|
|
|
|
|
map { $hash->{ $order[$_] } = $values[$_] } 0 .. 4; |
20
|
|
|
|
|
|
|
return $hash; |
21
|
|
|
|
|
|
|
}, from 'Str', via { |
22
|
|
|
|
|
|
|
my @values = split( /(?<!\\);/, $_ ); |
23
|
|
|
|
|
|
|
$values[4] ||= ''; |
24
|
|
|
|
|
|
|
my $hash = {}; |
25
|
|
|
|
|
|
|
map { $hash->{ $order[$_] } = $values[$_] } 0 .. 4; |
26
|
|
|
|
|
|
|
return $hash; |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
has content => ( is => 'rw', isa => 'Values', coerce => 1 ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
override 'as_string' => sub { |
31
|
|
|
|
|
|
|
my ($self) = @_; |
32
|
|
|
|
|
|
|
my @lines; |
33
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
34
|
|
|
|
|
|
|
push @lines, 'LANGUAGE=' . $self->language() if $self->language(); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my @values = map { $self->_escape($_) } |
37
|
|
|
|
|
|
|
map { $self->$_ or $self->content() && $self->content()->{$_} } @order; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . ':' . join( ';', @values ); |
40
|
|
|
|
|
|
|
return $self->fold( $string, -force => 1 ); |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
44
|
28
|
|
|
28
|
|
71144
|
no Moose; |
|
28
|
|
|
|
|
77
|
|
|
28
|
|
|
|
|
219
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#Alias |
47
|
|
|
|
|
|
|
sub family_name { |
48
|
0
|
|
|
0
|
0
|
|
family(@_); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub surname { |
52
|
0
|
|
|
0
|
0
|
|
family(@_); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub given_name { |
56
|
0
|
|
|
0
|
0
|
|
given (@_); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub additional_name { |
60
|
0
|
|
|
0
|
0
|
|
additional(@_); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub honorific_prefixes { |
64
|
0
|
|
|
0
|
0
|
|
prefixes(@_); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub honorific_suffixes { |
68
|
0
|
|
|
0
|
0
|
|
suffixes(@_); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |