TOON.pm

filter: Statementstmt 86.2% 25 / 29 Branchbran 0.0% 0 / 2 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 78.5% 11 / 14 Podpod 100% 10 / 10 totaltotal 76.5% 49 / 64 CC 7 SCAR 9.8
CC
7
Cov
76%
indent
6.0
new
5.3
to_toon
2.0
CRAP 2.7
« TOON/Error.pm ↑ Summary
1 package TOON;
2  
3 5 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use TOON::PP ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 our $VERSION = '0.0.1';
10 5 our @EXPORT_OK = qw(
11 encode_toon decode_toon
12 to_toon from_toon
13 );
14  
15 ▶sub encode_toon ($data, %opts) {
Subroutine encode_toon: called CC=1 SCAR=0.0
Pod documented
16 1 return TOON::PP->new(%opts)->encode($data);
17 }
18  
19 ▶sub decode_toon ($text, %opts) {
Subroutine decode_toon: called CC=1 SCAR=0.0
Pod documented
20 1 return TOON::PP->new(%opts)->decode($text);
21 }
22  
23 0 ▶sub to_toon ($data, %opts) { return encode_toon($data, %opts) }
Subroutine to_toon: not called CC=1 SCAR=6.9
Pod documented
24 0 ▶sub from_toon ($text, %opts) { return decode_toon($text, %opts) }
Subroutine from_toon: not called CC=1 SCAR=6.9
Pod documented
25  
26 ▶sub new ($class, %opts) {
Subroutine new: called CC=4 SCAR=16.6
Pod documented
27 return bless {
28 pretty => $opts{pretty} // 0,
29 canonical => $opts{canonical} // 0,
30 2 ▶ indent => $opts{indent} // 2,
Condition50%3/6
$opts{"pretty"} // 0
l!l
02
$opts{"canonical"} // 0
l!l
02
$opts{"indent"} // 2
l!l
02
MC/DC0%0/1
$opts{"pretty"} // 0
$opts{"pretty"}
MC/DC0%0/1
$opts{"canonical"} // 0
$opts{"canonical"}
MC/DC0%0/1
$opts{"indent"} // 2
$opts{"indent"}
Truth table50%1/2
A
A= $opts{"pretty"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"canonical"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"indent"}
Aresult
11
00
31 }, $class;
32 }
33  
34 ▶sub encode ($self, $data) {
Subroutine encode: called CC=1 SCAR=0.0
Pod documented
35 1 return TOON::PP->new(%$self)->encode($data);
36 }
37  
38 ▶sub decode ($self, $text) {
Subroutine decode: called CC=1 SCAR=0.0
Pod documented
39 2 return TOON::PP->new(%$self)->decode($text);
40 }
41  
42 1 ▶sub pretty ($self, $value = 1) {
Subroutine pretty: called CC=2 SCAR=6.9
Pod documented
43 1 $self->{pretty} = $value;
44 1 return $self;
45 }
46  
47 1 ▶sub canonical ($self, $value = 1) {
Subroutine canonical: called CC=2 SCAR=6.9
Pod documented
48 1 $self->{canonical} = $value;
49 1 return $self;
50 }
51  
52 ▶sub indent ($self, $value) {
Subroutine indent: not called CC=2 SCAR=17.9
Pod documented
53 0 ▶ $self->{indent} = $value if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
54 0 return $self;
55 }
56  
57 5 1;
58  
59 __END__
« TOON/Error.pm ↑ Summary