File Coverage

blib/lib/Text/vCard/Precisely/V3/Node/Address.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Text::vCard::Precisely::V3::Node::Address;
2              
3 28     28   6832 use Carp;
  28         68  
  28         1853  
4 28     28   181 use Moose;
  28         67  
  28         183  
5              
6             extends 'Text::vCard::Precisely::V3::Node';
7              
8             has name => ( is => 'ro', default => 'ADR', isa => 'Str' );
9             has content => ( is => 'ro', default => '', isa => 'Str' );
10              
11             our @order = qw( pobox extended street city region post_code country );
12             has \@order => ( is => 'rw', isa => 'Str' );
13              
14             override 'as_string' => sub {
15             my ($self) = @_;
16             my @lines;
17             push @lines, $self->name() || croak "Empty name";
18             push @lines, 'TYPE=' . join( ',', map {uc} @{ $self->types() } )
19             if ref $self->types() eq 'ARRAY' and $self->types()->[0];
20             push @lines, 'PREF=' . $self->pref() if $self->pref();
21             push @lines, 'LANGUAGE=' . $self->language() if $self->language();
22              
23             my $string = join( ';', @lines ) . ':' . join ';', map { $self->_escape( $self->$_ ) } @order;
24             return $self->fold($string);
25             };
26              
27             __PACKAGE__->meta->make_immutable;
28 28     28   176467 no Moose;
  28         143  
  28         147  
29              
30             1;