| 1 | package Test2::Tools::Encoding; | ||||||||||||||||||||||||||||
| 2 | 162 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 162 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 162 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 162 | ▶ | use Test2::API qw/test2_stack/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 162 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 162 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 162 | our @EXPORT = qw/set_encoding/; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | sub set_encoding { | ||||||||||||||||||||||||||
|
Subroutine
set_encoding: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 2 | my $enc = shift; | |||||||||||||||||||||||||||
| 17 | 2 | my $format = test2_stack->top->format; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | unless ($format && eval { $format->can('encoding') }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$format and eval {
do {
$format->can("encoding")
}
}
MC/DC50%1/2
$format and eval {
do {
$format->can("encoding")
}
}
$format
eval {
do {
$format->can("encoding")
}
}
Truth table66%2/3
A and B
A= $formatB= eval {
do {
$format->can("encoding")
}
}
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | $format = '<undef>' unless defined $format; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 1 | croak "Unable to set encoding on formatter '$format'"; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | $format->encoding($enc); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 162 | 1; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | __END__ | ||||||||||||||||||||||||||||