| 1 | package Text::CSV::Encoded::Coder::Encode; | ||||||||||||||||||||||||||||||||||||||||||||
| 2 | 11 | $Text::CSV::Encoded::Coder::Encode::VERSION = '0.25'; | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | # VERSION | ||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use base qw( Text::CSV::Encoded::Coder::Base ); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 11 | ▶ | use Encode (); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||
| 14 | 11 | my %EncoderCache; | |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 9 | ▶ | sub upgrade { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upgrade: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | ▶ | utf8::upgrade( $_[1] ) if ( $_[1] ); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 55 | ▶ | sub encode { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 23 | 55 | my ( $self, $encoding, $str ) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 55 | ▶ | return undef unless defined $str; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 55 | $self->find_encoding( $encoding )->encode( $str, $self->encode_check_value ); | |||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | 73 | ▶ | sub decode { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 73 | my ( $self, $encoding, $str ) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 73 | ▶ | return undef unless defined $str; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 72 | ▶ | if ( $self->{automatic_UTF8} and $encoding =~ /utf-?8/i ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"automatic_UTF8"} and $encoding =~ /utf-?8/i
MC/DC50%1/2
$self->{"automatic_UTF8"} and $encoding =~ /utf-?8/i
$self->{"automatic_UTF8"}
$encoding =~ /utf-?8/i
Truth table66%2/3
A and B
A= $self->{"automatic_UTF8"}B= $encoding =~ /utf-?8/i
| |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 46 | return $str; | |||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | 26 | $self->find_encoding( $encoding )->decode( $str, $self->decode_check_value ); | |||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 42 | ▶ | sub decode_fields_ref { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_fields_ref: called CC=6 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 42 | 42 | my ( $self, $encoding, $arrayref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 42 | ▶ | if ( $self->{automatic_UTF8} and $encoding =~ /utf-?8/i ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"automatic_UTF8"} and $encoding =~ /utf-?8/i
MC/DC50%1/2
$self->{"automatic_UTF8"} and $encoding =~ /utf-?8/i
$self->{"automatic_UTF8"}
$encoding =~ /utf-?8/i
Truth table66%2/3
A and B
A= $self->{"automatic_UTF8"}B= $encoding =~ /utf-?8/i
| |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | 32 | ▶ | my $enc = $self->find_encoding( $encoding ) || return; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->find_encoding($encoding) || (return)
MC/DC0%0/1
$self->find_encoding($encoding) || (return)
$self->find_encoding($encoding)
Truth table50%1/2
A
A= $self->find_encoding($encoding)
| |||||||||||||||||||||||||||||||||||||||||||||
| 49 | 32 | for ( @$arrayref ) { | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 32 | ▶ | $_ = $enc->decode( $_, $self->decode_check_value ) if defined $_; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 24 | ▶ | sub encode_fields_ref { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode_fields_ref: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 56 | 24 | my ( $self, $encoding, $arrayref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 24 | ▶ | my $enc = $self->find_encoding( $encoding ) || return; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->find_encoding($encoding) || (return)
MC/DC0%0/1
$self->find_encoding($encoding) || (return)
$self->find_encoding($encoding)
Truth table50%1/2
A
A= $self->find_encoding($encoding)
| |||||||||||||||||||||||||||||||||||||||||||||
| 58 | 24 | for ( @$arrayref ) { | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 24 | ▶ | $_ = $enc->encode( $_, $self->encode_check_value ) if defined $_; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | 137 | ▶ | sub find_encoding { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_encoding: called CC=5 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 137 | shift; | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 137 | ▶ | $EncoderCache { ($_[0] || 'utf8') } | ||||||||||||||||||||||||||||||||||||||||||
|
Condition55%5/9
$EncoderCache{$_[0] or "utf8"} ||= &Encode::find_encoding(scalar($_[0] || "utf8")) || Carp::croak("Not found such an encoding name '$_[0]'")
$_[0] || 'utf8'
&Encode::find_encoding(scalar($_[0] || 'utf8')) || Carp::croak("Not found such an encoding name '$_[0]'")
$_[0] || 'utf8'
MC/DC0%0/2
$EncoderCache{$_[0] or "utf8"} ||= &Encode::find_encoding(scalar($_[0] || "utf8")) || Carp::croak("Not found such an encoding name '$_[0]'")
$EncoderCache{$_[0] or "utf8"}
&Encode::find_encoding(scalar($_[0] || 'utf8'))
MC/DC0%0/1
$_[0] || 'utf8'
$_[0]
MC/DC0%0/1
$_[0] || 'utf8'
$_[0]
Truth table66%2/3
A ||= B
A= $EncoderCache{$_[0] or "utf8"}B= &Encode::find_encoding(scalar($_[0] || 'utf8'))
Truth table50%1/2
A
A= $_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 67 | ||= Encode::find_encoding( $_[0] || 'utf8' ) || Carp::croak ( "Not found such an encoding name '$_[0]'" ); | ||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||