| 1 | 14 | ▶ | use strictures 2; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | package HTTP::Headers::Fancy; | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 14 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 14 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | # ABSTRACT: Fancy naming schema of HTTP headers | ||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||
| 10 | 14 | our $VERSION = '1.000'; # VERSION | |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | 14 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||
| 13 | decode_key | ||||||||||||||||||||||||||||||||||
| 14 | encode_key | ||||||||||||||||||||||||||||||||||
| 15 | decode_hash | ||||||||||||||||||||||||||||||||||
| 16 | encode_hash | ||||||||||||||||||||||||||||||||||
| 17 | split_field_hash | ||||||||||||||||||||||||||||||||||
| 18 | split_field_list | ||||||||||||||||||||||||||||||||||
| 19 | build_field_hash | ||||||||||||||||||||||||||||||||||
| 20 | build_field_list | ||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | 14 | our %EXPORT_TAGS = ( all => \@EXPORT_OK, ); | |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | sub _self { | ||||||||||||||||||||||||||||||||||
| 26 | 189 | ▶ | my @args = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
_self: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 27 | 189 | ▶ | if ( blessed $args[0] and $args[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
builtin::blessed($args[0]) and $args[0]->isa(__PACKAGE__)
MC/DC50%1/2
builtin::blessed($args[0]) and $args[0]->isa(__PACKAGE__)
builtin::blessed($args[0])
$args[0]->isa(__PACKAGE__)
Truth table66%2/3
A and B
A= builtin::blessed($args[0])B= $args[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||||
| 28 | 38 | return @args; | |||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||
| 30 | ▶ | elsif ( defined $args[0] and not ref $args[0] and $args[0] eq __PACKAGE__ ) | |||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $args[0] and not ref $args[0] and $args[0] eq __PACKAGE__
defined $args[0] and not ref $args[0]
MC/DC100%3/3
defined $args[0] and not ref $args[0] and $args[0] eq __PACKAGE__
defined $args[0]
not ref $args[0]
$args[0] eq __PACKAGE__
Truth table100%4/4
A and not(B) and C
A= defined $args[0]B= not ref $args[0]C= $args[0] eq __PACKAGE__
| |||||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||||
| 32 | 18 | return @args; | |||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||
| 34 | else { | ||||||||||||||||||||||||||||||||||
| 35 | 133 | return ( __PACKAGE__, @args ); | |||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||
| 39 | sub _encode_hash_deeply { | ||||||||||||||||||||||||||||||||||
| 40 | 6 | ▶ | my ( $self, @args ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
_encode_hash_deeply: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||
| 41 | 6 | ▶ | if ( ref $args[0] ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 42 | 2 | return { $self->_encode_hash_deeply( %{ $args[0] } ) }; | |||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||
| 44 | 4 | my %hash = $self->encode_hash(@args); | |||||||||||||||||||||||||||||||||
| 45 | 4 | foreach my $key ( keys %hash ) { | |||||||||||||||||||||||||||||||||
| 46 | 8 | ▶ | if ( ref $hash{$key} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 47 | 4 | $hash{$key} = $self->build( $hash{$key} ); | |||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||
| 50 | 4 | return %hash; | |||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||
| 53 | sub decode_key { | ||||||||||||||||||||||||||||||||||
| 54 | 50 | ▶ | my ( $self, $k ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
decode_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 55 | 50 | $k =~ s{^([^-]+)}{ucfirst(lc($1))}se; | |||||||||||||||||||||||||||||||||
| 56 | 50 | $k =~ s{-+([^-]+)}{ucfirst(lc($1))}sge; | |||||||||||||||||||||||||||||||||
| 57 | 50 | $k =~ s{^X([A-Z])}{-$1}s; | |||||||||||||||||||||||||||||||||
| 58 | 50 | return ucfirst($k); | |||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||
| 61 | sub decode_hash { | ||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | my ( $self, @args ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
decode_hash: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 63 | 2 | ▶ | my %headers = @args == 1 ? %{ $args[0] } : @args; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 64 | 2 | foreach my $old ( keys %headers ) { | |||||||||||||||||||||||||||||||||
| 65 | 14 | my $new = decode_key($old); | |||||||||||||||||||||||||||||||||
| 66 | 14 | ▶ | if ( $old ne $new ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 67 | 12 | $headers{$new} = delete $headers{$old}; | |||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||
| 70 | 2 | ▶ | wantarray ? %headers : \%headers; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||
| 73 | sub encode_key { | ||||||||||||||||||||||||||||||||||
| 74 | 64 | ▶ | my ( $self, $k ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
encode_key: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 75 | 64 | $k =~ s{_}{-}sg; | |||||||||||||||||||||||||||||||||
| 76 | 64 | $k =~ s{-+}{-}sg; | |||||||||||||||||||||||||||||||||
| 77 | 64 | $k =~ s{^-(.)}{'X'.uc($1)}se; | |||||||||||||||||||||||||||||||||
| 78 | 64 | ▶ | $k =~ s{([^-])([A-Z])}{$1-$2}s while $k =~ m{([^-])([A-Z])}s; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 79 | 64 | return lc($k); | |||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | sub encode_hash { | ||||||||||||||||||||||||||||||||||
| 83 | 6 | ▶ | my ( $self, @args ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
encode_hash: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 84 | 6 | ▶ | my %headers = @args == 1 ? %{ $args[0] } : @args; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 85 | 6 | foreach my $old ( keys %headers ) { | |||||||||||||||||||||||||||||||||
| 86 | 34 | ▶ | delete $headers{$old} unless defined $headers{$old}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 87 | 34 | my $new = encode_key($old); | |||||||||||||||||||||||||||||||||
| 88 | 34 | ▶ | if ( $old ne $new ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 89 | 30 | $headers{$new} = delete $headers{$old}; | |||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||
| 92 | 6 | ▶ | wantarray ? %headers : \%headers; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||
| 95 | sub split_field_hash { | ||||||||||||||||||||||||||||||||||
| 96 | 20 | ▶ | my ( $self, $value, @rest ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
split_field_hash: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 97 | 20 | ▶ | return () unless defined $value; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 98 | 18 | ▶ | if ( ref $value eq 'HASH' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 99 | 1 | foreach my $key (@rest) { | |||||||||||||||||||||||||||||||||
| 100 | 2 | $value->{$key} = { $self->split_field_hash( $value->{$key} ) }; | |||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||
| 102 | 1 | return $value; | |||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||
| 104 | 17 | pos($value) = 0; | |||||||||||||||||||||||||||||||||
| 105 | 17 | my %data; | |||||||||||||||||||||||||||||||||
| 106 | 17 | $value .= ','; | |||||||||||||||||||||||||||||||||
| 107 | 17 | ▶ | while ( $value =~ | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 108 | m{ \G \s* (?<key> [^=,]+? ) \s* (?: \s* = \s* (?: (?: " (?<value> [^"]*? ) " ) | (?<value> [^,]*? ) ) )? \s* ,+ \s* }gsx | ||||||||||||||||||||||||||||||||||
| 109 | ) | ||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||
| 111 | 29 | $data{ decode_key( $+{key} ) } = $+{value}; | |||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||
| 113 | 17 | return %data; | |||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||
| 116 | sub split_field_list { | ||||||||||||||||||||||||||||||||||
| 117 | 11 | ▶ | my ( $self, $value, @rest ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
split_field_list: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 118 | 11 | ▶ | return () unless defined $value; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 119 | 11 | ▶ | if ( ref $value eq 'HASH' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 120 | 1 | foreach my $key (@rest) { | |||||||||||||||||||||||||||||||||
| 121 | 2 | $value->{$key} = [ $self->split_field_list( $value->{$key} ) ]; | |||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||
| 123 | 1 | return $value; | |||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||
| 125 | 10 | pos($value) = 0; | |||||||||||||||||||||||||||||||||
| 126 | 10 | my @data; | |||||||||||||||||||||||||||||||||
| 127 | 10 | $value .= ','; | |||||||||||||||||||||||||||||||||
| 128 | 10 | ▶ | while ( $value =~ | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 129 | m{ \G \s* (?<weak> W/ )? " (?<value> [^"]*? ) " \s* ,+ \s* }gsix ) | ||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||
| 131 | 17 | my $value = $+{value}; | |||||||||||||||||||||||||||||||||
| 132 | 17 | ▶ | push @data => $+{weak} ? \$value : $value; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||
| 134 | 10 | return @data; | |||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||
| 137 | sub build_field_hash { | ||||||||||||||||||||||||||||||||||
| 138 | 15 | ▶ | my ( $self, @args ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
build_field_hash: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 139 | 15 | ▶ | if ( ref $args[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 140 | 4 | return $self->build_field_hash( %{ $args[0] } ); | |||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||
| 142 | 11 | my %data = @args; | |||||||||||||||||||||||||||||||||
| 143 | return join ', ', sort map { | ||||||||||||||||||||||||||||||||||
| 144 | 11 | $self->encode_key($_) | |||||||||||||||||||||||||||||||||
| 145 | . ( | ||||||||||||||||||||||||||||||||||
| 146 | defined( $data{$_} ) | ||||||||||||||||||||||||||||||||||
| 147 | ? '=' | ||||||||||||||||||||||||||||||||||
| 148 | . ( | ||||||||||||||||||||||||||||||||||
| 149 | ( $data{$_} =~ m{[=,]} ) | ||||||||||||||||||||||||||||||||||
| 150 | ? '"' . $data{$_} . '"' | ||||||||||||||||||||||||||||||||||
| 151 | 17 | ▶ | : $data{$_} | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 152 | ) | ||||||||||||||||||||||||||||||||||
| 153 | : '' | ||||||||||||||||||||||||||||||||||
| 154 | ) | ||||||||||||||||||||||||||||||||||
| 155 | } keys %data; | ||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||
| 158 | sub build_field_list { | ||||||||||||||||||||||||||||||||||
| 159 | 15 | ▶ | my ( $self, @args ) = _self(@_); | ||||||||||||||||||||||||||||||||
|
Subroutine
build_field_list: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 160 | 15 | ▶ | if ( ref $args[0] eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 161 | 6 | return $self->build_field_list( @{ $args[0] } ); | |||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||
| 163 | 9 | ▶ | return join ', ', map { ref($_) ? 'W/"' . $$_ . '"' : qq{"$_"} } @args; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||
| 166 | sub new { | ||||||||||||||||||||||||||||||||||
| 167 | 6 | ▶ | my $class = shift // __PACKAGE__; | ||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=13.1
Pod
documented
Condition50%1/2
shift() // __PACKAGE__
MC/DC0%0/1
shift() // __PACKAGE__
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||
| 168 | 6 | ▶ | return bless {@_} => ref $class || $class; | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||
| 171 | sub encode { | ||||||||||||||||||||||||||||||||||
| 172 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||
|
Subroutine
encode: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 173 | 6 | ▶ | return unless @_; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 174 | 4 | ▶ | if ( @_ > 1 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 175 | 2 | return $self->_encode_hash_deeply(@_); | |||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||
| 177 | elsif ( ref $_[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||
| 178 | 2 | return $self->_encode_hash_deeply( $_[0] ); | |||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||
| 180 | else { | ||||||||||||||||||||||||||||||||||
| 181 | 0 | return $self->encode_key( $_[0] ); | |||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||
| 185 | sub decode { | ||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||
|
Subroutine
decode: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | return unless @_; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ( @_ > 1 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 189 | 0 | return $self->decode_hash(@_); | |||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||
| 191 | elsif ( ref $_[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||
| 192 | 0 | return $self->decode_hash( $_[0] ); | |||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||
| 195 | 0 | return $self->decode_key( $_[0] ); | |||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||
| 199 | sub split { | ||||||||||||||||||||||||||||||||||
| 200 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||
|
Subroutine
split: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 201 | 5 | ▶ | return unless @_; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 202 | 4 | my $val = shift; | |||||||||||||||||||||||||||||||||
| 203 | 4 | ▶ | if ( $val =~ m{^ \s* ( W/ ) ? " }six ) { | ||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||
| 204 | 2 | return $self->split_field_list($val); | |||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||
| 206 | elsif ( not ref $val ) { | ||||||||||||||||||||||||||||||||||
| 207 | 1 | return $self->split_field_hash($val); | |||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||
| 209 | elsif ( ref $val eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||
| 210 | 1 | foreach my $key (@_) { | |||||||||||||||||||||||||||||||||
| 211 | 3 | ▶ | next unless $val->{$key}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 212 | 3 | ▶ | if ( $val->{$key} =~ m{^ \s* ( W/ )? " }six ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 213 | 2 | $val->{$key} = [ $self->split_field_list( $val->{$key} ) ]; | |||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||
| 215 | else { | ||||||||||||||||||||||||||||||||||
| 216 | 1 | $val->{$key} = { $self->split_field_hash( $val->{$key} ) }; | |||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||
| 219 | 1 | return $val; | |||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||
| 223 | sub build { | ||||||||||||||||||||||||||||||||||
| 224 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 225 | 7 | ▶ | if ( ref $_[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 226 | 3 | return $self->build_field_hash(@_); | |||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||
| 228 | elsif ( ref $_[0] eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||
| 229 | 3 | return $self->build_field_list(@_); | |||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||
| 232 | 1 | return $self->build_field_hash(@_); | |||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||
| 236 | sub etags { | ||||||||||||||||||||||||||||||||||
| 237 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||
|
Subroutine
etags: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 238 | 2 | return $self->build_field_list(@_); | |||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||
| 241 | 14 | 1; | |||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||
| 243 | __END__ | ||||||||||||||||||||||||||||||||||