blib/lib/XML/Pastor/Builtin/boolean.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 94.2% 33 / 35 CC 2 SCAR 2.5
CC
2
Cov
93%
boolify
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« test/out/lib/XML/Pastor/Test/Type/Population.pm ↑ Summary test/out/lib/XML/Pastor/Test/Type/Country_name.pm »
1 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 #======================================================================
7 package XML::Pastor::Builtin::boolean;
8 10 ▶use XML::Pastor::Builtin::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
9
10 10 our @ISA = qw(XML::Pastor::Builtin::Scalar);
11
12 use overload
13 10 ▶ 'bool' => \&boolify;
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15
16 10 XML::Pastor::Builtin::boolean->XmlSchemaType( bless( {
17 'class' => 'XML::Pastor::Builtin::boolean',
18 'contentType' => 'simple',
19 'derivedBy' => 'restriction',
20 'enumeration' => {
21 '0' => '1',
22 '1' => '1',
23 'false' => '1',
24 'true' => '1',
25 },
26 'name' => 'boolean|http://www.w3.org/2001/XMLSchema',
27 }, 'XML::Pastor::Schema::SimpleType' ) );
28
29
30
31 #----------------------------------------------
32 # Boolean value.
33 #----------------------------------------------
34 1 ▶sub boolify {
Subroutine boolify: called CC=2 SCAR=7.6
Pod documented
35 1 my $self = shift;
36 1 my $val = $self->__value();
37
38 1 ▶ return 0 if ($val =~ /false/io);
Branch: 1 branch
BranchTrueFalseTotal
if $val =~ /false/io 1 0 1
39 0 return $val;
40 }
41
42 10 1;
43
44 __END__
« test/out/lib/XML/Pastor/Test/Type/Population.pm ↑ Summary test/out/lib/XML/Pastor/Test/Type/Country_name.pm »