line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Tools::Encoding; |
2
|
155
|
|
|
155
|
|
1121
|
use strict; |
|
155
|
|
|
|
|
372
|
|
|
155
|
|
|
|
|
4786
|
|
3
|
155
|
|
|
155
|
|
847
|
use warnings; |
|
155
|
|
|
|
|
300
|
|
|
155
|
|
|
|
|
4164
|
|
4
|
|
|
|
|
|
|
|
5
|
155
|
|
|
155
|
|
806
|
use Carp qw/croak/; |
|
155
|
|
|
|
|
305
|
|
|
155
|
|
|
|
|
7428
|
|
6
|
|
|
|
|
|
|
|
7
|
155
|
|
|
155
|
|
982
|
use Test2::API qw/test2_stack/; |
|
155
|
|
|
|
|
378
|
|
|
155
|
|
|
|
|
7450
|
|
8
|
|
|
|
|
|
|
|
9
|
155
|
|
|
155
|
|
1009
|
use base 'Exporter'; |
|
155
|
|
|
|
|
359
|
|
|
155
|
|
|
|
|
40985
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.000156'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw/set_encoding/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_encoding { |
16
|
2
|
|
|
2
|
1
|
744
|
my $enc = shift; |
17
|
2
|
|
|
|
|
19
|
my $format = test2_stack->top->format; |
18
|
|
|
|
|
|
|
|
19
|
2
|
100
|
66
|
|
|
50
|
unless ($format && eval { $format->can('encoding') }) { |
|
1
|
|
|
|
|
8
|
|
20
|
1
|
50
|
|
|
|
14
|
$format = '' unless defined $format; |
21
|
1
|
|
|
|
|
251
|
croak "Unable to set encoding on formatter '$format'"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
$format->encoding($enc); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |