line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V3::Node::SocialProfile; |
2
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
244
|
use Carp; |
|
28
|
|
|
|
|
95
|
|
|
28
|
|
|
|
|
2712
|
|
4
|
28
|
|
|
28
|
|
258
|
use Encode; |
|
28
|
|
|
|
|
70
|
|
|
28
|
|
|
|
|
5303
|
|
5
|
|
|
|
|
|
|
|
6
|
28
|
|
|
28
|
|
219
|
use Moose; |
|
28
|
|
|
|
|
75
|
|
|
28
|
|
|
|
|
319
|
|
7
|
28
|
|
|
28
|
|
200688
|
use Moose::Util::TypeConstraints; |
|
28
|
|
|
|
|
107
|
|
|
28
|
|
|
|
|
293
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Text::vCard::Precisely::V3::Node'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( is => 'ro', default => 'X-SOCIALPROFILE', isa => 'Str' ); |
12
|
|
|
|
|
|
|
has content => ( is => 'rw', isa => 'Str', required => 1 ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
subtype 'SocialProfileType' => as 'Str' => where { |
15
|
|
|
|
|
|
|
m/^(?:facebook|twitter|LinkedIn|flickr|myspace|sinaweibo|LINE|GitHub|Instagram|YouTube|Twitch)$/is |
16
|
|
|
|
|
|
|
} => message {"The text you provided, $_, was not supported in 'SocialProfileType'"}; |
17
|
|
|
|
|
|
|
has types => ( is => 'rw', isa => 'SocialProfileType', required => 1 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has userid => ( is => 'rw', isa => 'Str' ); |
20
|
|
|
|
|
|
|
|
21
|
28
|
|
|
28
|
|
69618
|
subtype 'SocialProfileName' => as 'Str' => where { use utf8; decode_utf8($_) =~ m/^[\w\s]+$/s } |
|
28
|
|
|
|
|
145
|
|
|
28
|
|
|
|
|
709
|
|
22
|
|
|
|
|
|
|
=> message {"The text you provided, $_, was not supported in 'SocialProfileName'"}; |
23
|
|
|
|
|
|
|
coerce 'SocialProfileName', from 'Str', via { encode_utf8($_) }; |
24
|
|
|
|
|
|
|
has displayname => ( is => 'rw', isa => 'SocialProfileName', coerce => 1 ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
override 'as_string' => sub { |
27
|
|
|
|
|
|
|
my ($self) = @_; |
28
|
|
|
|
|
|
|
my @lines; |
29
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
30
|
|
|
|
|
|
|
push @lines, 'ALTID=' . $self->altID() if $self->can('altID') and $self->altID(); |
31
|
|
|
|
|
|
|
push @lines, 'PID=' . join ',', @{ $self->pid() } if $self->can('pid') and $self->pid(); |
32
|
|
|
|
|
|
|
push @lines, 'TYPE=' . $self->types() || croak "Empty types"; |
33
|
|
|
|
|
|
|
push @lines, 'X-USERID=' . $self->userid() if defined $self->userid() and $self->userid(); |
34
|
|
|
|
|
|
|
push @lines, 'X-DISPLAYNAME=' . $self->displayname() |
35
|
|
|
|
|
|
|
if defined $self->displayname() |
36
|
|
|
|
|
|
|
and $self->displayname(); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . ':' . $self->content(); |
39
|
|
|
|
|
|
|
return $self->fold( $string, -force => 1 ); |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
43
|
28
|
|
|
28
|
|
12021
|
no Moose; |
|
28
|
|
|
|
|
96
|
|
|
28
|
|
|
|
|
203
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |