| 1 | package Text::CSV::Encoded::Coder::EncodeGuess; | ||||||||||||
| 2 | 1 | $Text::CSV::Encoded::Coder::EncodeGuess::VERSION = '0.25'; | |||||||||||
| 3 | 1 | ▶ | use 5.008; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | # VERSION | ||||||||||||
| 8 | |||||||||||||
| 9 | 1 | ▶ | use base qw( Text::CSV::Encoded::Coder::Encode ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | ▶ | use Carp (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 1 | ▶ | use Encode (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 1 | ▶ | use Encode::Guess; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | |||||||||||||
| 16 | 2 | ▶ | sub decode { | ||||||||||
|
Subroutine
decode: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||
| 17 | 2 | my ( $self, $encoding, $str ) = @_; | |||||||||||
| 18 | |||||||||||||
| 19 | 2 | ▶ | return undef unless defined $str; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 20 | |||||||||||||
| 21 | 2 | ▶ | if ( ref $encoding ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | 2 | my $enc = Encode::Guess::guess_encoding( $str, @$encoding ); | |||||||||||
| 23 | 2 | ▶ | $enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 24 | 2 | return $enc->decode( $str, $self->decode_check_value ); | |||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | 0 | $self->find_encoding( $encoding )->decode( $str, $self->decode_check_value ); | |||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | |||||||||||||
| 31 | 1 | ▶ | sub decode_fields_ref { | ||||||||||
|
Subroutine
decode_fields_ref: called CC=6 SCAR=22.7
Pod
documented
| |||||||||||||
| 32 | 1 | my ( $self, $encoding, $arrayref ) = @_; | |||||||||||
| 33 | |||||||||||||
| 34 | 1 | ▶ | if ( ref $encoding ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 1 | for ( @$arrayref ) { | |||||||||||
| 36 | 2 | my $enc = Encode::Guess::guess_encoding( $_, @$encoding ); | |||||||||||
| 37 | 2 | ▶ | $enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | 2 | $_ = $enc->decode( $_, $self->decode_check_value ); | |||||||||||
| 39 | } | ||||||||||||
| 40 | } | ||||||||||||
| 41 | else { | ||||||||||||
| 42 | 0 | ▶ | my $enc = $self->find_encoding( $encoding ) || return; | ||||||||||
|
Condition0%0/2
$self->find_encoding($encoding) || (return)
MC/DC0%0/1
$self->find_encoding($encoding) || (return)
$self->find_encoding($encoding)
Truth table0%0/2
A
A= $self->find_encoding($encoding)
| |||||||||||||
| 43 | 0 | for ( @$arrayref ) { | |||||||||||
| 44 | 0 | $_ = $enc->decode( $_, $self->decode_check_value ); | |||||||||||
| 45 | } | ||||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | } | ||||||||||||
| 49 | |||||||||||||
| 50 | |||||||||||||
| 51 | 1 | 1; | |||||||||||
| 52 | __END__ | ||||||||||||