line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::CSV::Encoded::Coder::EncodeGuess; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use base qw( Text::CSV::Encoded::Coder::Encode ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
543
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
10
|
1
|
|
|
1
|
|
5
|
use Encode (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
11
|
1
|
|
|
1
|
|
2119
|
use Encode::Guess; |
|
1
|
|
|
|
|
7792
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub decode { |
17
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $encoding, $str ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
50
|
|
|
|
6
|
return undef unless defined $str; |
20
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
6
|
if ( ref $encoding ) { |
22
|
2
|
|
|
|
|
5
|
my $enc = Encode::Guess::guess_encoding( $str, @$encoding ); |
23
|
2
|
50
|
|
|
|
175
|
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; |
24
|
2
|
|
|
|
|
11
|
return $enc->decode( $str, $self->decode_check_value ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
$self->find_encoding( $encoding )->decode( $str, $self->decode_check_value ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub decode_fields_ref { |
32
|
1
|
|
|
1
|
1
|
4
|
my ( $self, $encoding, $arrayref ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
6
|
if ( ref $encoding ) { |
35
|
1
|
|
|
|
|
5
|
for ( @$arrayref ) { |
36
|
2
|
|
|
|
|
12
|
my $enc = Encode::Guess::guess_encoding( $_, @$encoding ); |
37
|
2
|
50
|
|
|
|
348
|
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; |
38
|
2
|
|
|
|
|
14
|
$_ = $enc->decode( $_, $self->decode_check_value ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
|
0
|
|
|
|
my $enc = $self->find_encoding( $encoding ) || return; |
43
|
0
|
|
|
|
|
|
for ( @$arrayref ) { |
44
|
0
|
|
|
|
|
|
$_ = $enc->decode( $_, $self->decode_check_value ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |