line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::CSV::Encoded::Coder::EncodeGuess; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
42
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use base qw( Text::CSV::Encoded::Coder::Encode ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
641
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
11
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
10
|
1
|
|
|
1
|
|
5
|
use Encode (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
11
|
1
|
|
|
1
|
|
292965
|
use Encode::Guess; |
|
1
|
|
|
|
|
29315
|
|
|
1
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub decode { |
17
|
2
|
|
|
2
|
1
|
6
|
my ( $self, $encoding, $str ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
50
|
|
|
|
5
|
return undef unless defined $str; |
20
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
7
|
if ( ref $encoding ) { |
22
|
2
|
|
|
|
|
6
|
my $enc = Encode::Guess::guess_encoding( $str, @$encoding ); |
23
|
2
|
50
|
|
|
|
233
|
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; |
24
|
2
|
|
|
|
|
7
|
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
|
2
|
my ( $self, $encoding, $arrayref ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
5
|
if ( ref $encoding ) { |
35
|
1
|
|
|
|
|
5
|
for ( @$arrayref ) { |
36
|
2
|
|
|
|
|
8
|
my $enc = Encode::Guess::guess_encoding( $_, @$encoding ); |
37
|
2
|
50
|
|
|
|
233
|
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc; |
38
|
2
|
|
|
|
|
12
|
$_ = $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__ |