| 1 | |||||||||||||||||||||
| 2 | package Data::Decode::Encode::Guess; | ||||||||||||||||||||
| 3 | 6 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 6 | ▶ | use namespace::clean -except => qw(meta); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 6 | ▶ | use Encode(); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 6 | ▶ | use Encode::Guess(); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 6 | has encodings => ( | |||||||||||||||||||
| 9 | is => 'ro', | ||||||||||||||||||||
| 10 | isa => 'ArrayRef', | ||||||||||||||||||||
| 11 | lazy_build => 1, | ||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 0 | ▶ | sub _build_encodings { | ||||||||||||||||||
|
Subroutine
_build_encodings: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 15 | 0 | return []; | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 13 | ▶ | sub guess_encoding { | ||||||||||||||||||
|
Subroutine
guess_encoding: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 19 | 13 | my ($self, $decoder, $string, $hints) = @_; | |||||||||||||||||||
| 20 | 13 | local $Encode::Guess::NoUTFAutoGuess = 1; | |||||||||||||||||||
| 21 | return Encode::Guess::guess_encoding( | ||||||||||||||||||||
| 22 | $string, | ||||||||||||||||||||
| 23 | 13 | @{ $self->encodings } | |||||||||||||||||||
| 24 | ); | ||||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 13 | ▶ | sub decode { | ||||||||||||||||||
|
Subroutine
decode: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||
| 28 | 13 | my ($self, $decoder, $string, $hints) = @_; | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 13 | my $guess = $self->guess_encoding($decoder, $string, $hints); | |||||||||||||||||||
| 31 | 13 | ▶ | if (! ref $guess) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 3 | Data::Decode::Exception::Deferred->throw($guess); | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 10 | ▶ | return eval { $guess->decode( $string ) } || | ||||||||||||||||||
|
Condition33%1/3
eval {
do {
$guess->decode($string)
}
} || 'Data::Decode::Exception::Deferred'->throw('Failed to decode string from ' . $guess->name . ": $@")
MC/DC0%0/2
eval {
do {
$guess->decode($string)
}
} || 'Data::Decode::Exception::Deferred'->throw('Failed to decode string from ' . $guess->name . ": $@")
eval {
do {
$guess->decode($string)
}
}
'Data::Decode::Exception::Deferred'->throw('Failed to decode string from ' . $guess->name . ": $@")
Truth table33%1/3
A || B
A= eval {
do {
$guess->decode($string)
}
}B= 'Data::Decode::Exception::Deferred'->throw('Failed to decode string from ' . $guess->name . ": $@")
| |||||||||||||||||||||
| 36 | Data::Decode::Exception::Deferred->throw("Failed to decode string from " . $guess->name . ": $@") | ||||||||||||||||||||
| 37 | ; | ||||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 6 | 1; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||