line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::vCard::Precisely::V4::Node::Tel; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
118
|
use Carp; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
1203
|
|
4
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
111
|
use Moose; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
123
|
|
6
|
14
|
|
|
14
|
|
95685
|
use Moose::Util::TypeConstraints; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
169
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends qw|Text::vCard::Precisely::V3::Node::Tel Text::vCard::Precisely::V4::Node|; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# to validate phone numbers is too difficult for me |
11
|
|
|
|
|
|
|
#subtype 'v4Tel' |
12
|
|
|
|
|
|
|
# => as 'Str' |
13
|
|
|
|
|
|
|
# => where { m/^(?:tel:)?(?:[+]?\d{1,2}|\d*)[\(\s\-]?\d{1,3}[\)\s\-]?[\s]?\d{1,3}[\s\-]?\d{3,4}$/s } |
14
|
|
|
|
|
|
|
# => message { "The Number you provided, $_, was not supported in Tel" }; |
15
|
|
|
|
|
|
|
has content => ( is => 'ro', default => '', isa => 'Str' ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
override 'as_string' => sub { |
18
|
|
|
|
|
|
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
my @lines; |
20
|
|
|
|
|
|
|
push @lines, $self->name() || croak "Empty name"; |
21
|
|
|
|
|
|
|
push @lines, 'VALUE=uri'; |
22
|
|
|
|
|
|
|
push @lines, 'ALTID=' . $self->altID() if $self->altID(); |
23
|
|
|
|
|
|
|
push @lines, 'PID=' . join ',', @{ $self->pid() } if $self->pid(); |
24
|
|
|
|
|
|
|
push @lines, 'TYPE="' . join( ',', map { uc $_ } grep { length $_ } @{ $self->types() } ) . '"' |
25
|
|
|
|
|
|
|
if ref $self->types() eq 'ARRAY' and $self->types()->[0]; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#( my $content = $self->content() ) =~ s/^\s+//s; # remove top space |
28
|
|
|
|
|
|
|
#$content =~ s/^tel:\(?//s; # remove tel: once |
29
|
|
|
|
|
|
|
#$content =~ s/(?:(?!\A)\D|\()+/ /sg; # replace symbols to space |
30
|
|
|
|
|
|
|
#$content =~ s/^\s+//s; # remove top space again |
31
|
|
|
|
|
|
|
#my $string = join(';', @lines ) . ':tel:' . $content; |
32
|
|
|
|
|
|
|
my $colon = $self->content() =~ /^tel:/ ? ':' : ':tel:'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $string = join( ';', @lines ) . $colon . $self->content(); |
35
|
|
|
|
|
|
|
return $self->fold( $string, -force => 1 ); |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
14
|
|
|
14
|
|
35294
|
no Moose; |
|
14
|
|
|
|
|
49
|
|
|
14
|
|
|
|
|
92
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |