line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Tools::Encoding; |
2
|
154
|
|
|
154
|
|
1023
|
use strict; |
|
154
|
|
|
|
|
304
|
|
|
154
|
|
|
|
|
4300
|
|
3
|
154
|
|
|
154
|
|
755
|
use warnings; |
|
154
|
|
|
|
|
279
|
|
|
154
|
|
|
|
|
3912
|
|
4
|
|
|
|
|
|
|
|
5
|
154
|
|
|
154
|
|
750
|
use Carp qw/croak/; |
|
154
|
|
|
|
|
300
|
|
|
154
|
|
|
|
|
6710
|
|
6
|
|
|
|
|
|
|
|
7
|
154
|
|
|
154
|
|
849
|
use Test2::API qw/test2_stack/; |
|
154
|
|
|
|
|
378
|
|
|
154
|
|
|
|
|
6607
|
|
8
|
|
|
|
|
|
|
|
9
|
154
|
|
|
154
|
|
1199
|
use base 'Exporter'; |
|
154
|
|
|
|
|
316
|
|
|
154
|
|
|
|
|
34653
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw/set_encoding/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_encoding { |
16
|
2
|
|
|
2
|
1
|
608
|
my $enc = shift; |
17
|
2
|
|
|
|
|
6
|
my $format = test2_stack->top->format; |
18
|
|
|
|
|
|
|
|
19
|
2
|
100
|
66
|
|
|
32
|
unless ($format && eval { $format->can('encoding') }) { |
|
1
|
|
|
|
|
7
|
|
20
|
1
|
50
|
|
|
|
6
|
$format = '' unless defined $format; |
21
|
1
|
|
|
|
|
208
|
croak "Unable to set encoding on formatter '$format'"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
$format->encoding($enc); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |