line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Tools::Encoding; |
2
|
155
|
|
|
155
|
|
1098
|
use strict; |
|
155
|
|
|
|
|
317
|
|
|
155
|
|
|
|
|
4483
|
|
3
|
155
|
|
|
155
|
|
816
|
use warnings; |
|
155
|
|
|
|
|
304
|
|
|
155
|
|
|
|
|
4098
|
|
4
|
|
|
|
|
|
|
|
5
|
155
|
|
|
155
|
|
831
|
use Carp qw/croak/; |
|
155
|
|
|
|
|
315
|
|
|
155
|
|
|
|
|
7385
|
|
6
|
|
|
|
|
|
|
|
7
|
155
|
|
|
155
|
|
1101
|
use Test2::API qw/test2_stack/; |
|
155
|
|
|
|
|
379
|
|
|
155
|
|
|
|
|
6981
|
|
8
|
|
|
|
|
|
|
|
9
|
155
|
|
|
155
|
|
960
|
use base 'Exporter'; |
|
155
|
|
|
|
|
357
|
|
|
155
|
|
|
|
|
37669
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw/set_encoding/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_encoding { |
16
|
2
|
|
|
2
|
1
|
704
|
my $enc = shift; |
17
|
2
|
|
|
|
|
7
|
my $format = test2_stack->top->format; |
18
|
|
|
|
|
|
|
|
19
|
2
|
100
|
66
|
|
|
45
|
unless ($format && eval { $format->can('encoding') }) { |
|
1
|
|
|
|
|
9
|
|
20
|
1
|
50
|
|
|
|
12
|
$format = '' unless defined $format; |
21
|
1
|
|
|
|
|
238
|
croak "Unable to set encoding on formatter '$format'"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
$format->encoding($enc); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |