blib/lib/CIAO/Lib/StackIO.pm

filter: Statementstmt 100% 31 / 31 Branchbran 64.2% 9 / 14 Conditioncond 87.5% 7 / 8 MC/DCmcdc 80.0% 4 / 5 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 88.8% 56 / 63 CC 11 SCAR 22.2
CC
11
Cov
89%
new
11.4
BEGIN
1.0
BEGIN
1.0
CRAP 9.2
↑ Summary StackIO.xs »
1 package CIAO::Lib::StackIO;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 our $VERSION = '0.02';
9  
10 1 require XSLoader;
11 1 XSLoader::load('CIAO::Lib::StackIO', $VERSION);
12  
13 # Preloaded methods go here.
14  
15 1 our %Options = ( prepend => 1, expand => 1 );
16  
17 sub new
18 6 ▶{
Subroutine new: called CC=11 SCAR=24.4
Pod documented
19 6 my $class = shift;
20 6 my $list = shift;
21 6 ▶ my $opts = shift || { prepend => 1, expand => 0 };
Condition100%2/2
shift() || {'prepend', 1, 'expand', 0}
l!l
24
MC/DC100%1/1
shift() || {'prepend', 1, 'expand', 0}
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
22  
23 6 ▶ croak( __PACKAGE__, ": options must be hash ref\n" )
Branch: 1 branch
BranchTrueFalseTotal
unless "HASH" eq ref $opts 0 6 6
24 unless 'HASH' eq ref $opts;
25  
26 6 ▶ croak( __PACKAGE__, ": extra arguments to constructor\n" )
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 6 6
27 if @_;
28  
29 6 my @badopts = grep { ! exists $Options{lc $_ } } keys %$opts;
30 6 ▶ croak( __PACKAGE__, ": unknown options: ", join(', ', @badopts ) )
Branch: 1 branch
BranchTrueFalseTotal
if @badopts 0 6 6
31 if @badopts;
32  
33 6 my %opts = map { lc $_ => $opts->{$_} } keys %$opts;
34  
35 6 my $stack;
36 6 ▶ if ( exists $opts{expand} && $opts{expand} )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $opts{'expand'} and $opts{'expand'}) { } 1 5 6
Condition100%3/3
exists $opts{"expand"} and $opts{"expand"}
!ll&&!rl&&r
141
MC/DC100%2/2
exists $opts{"expand"} and $opts{"expand"}
exists $opts{"expand"} $opts{"expand"}
Truth table100%3/3
A and B
A= exists $opts{"expand"}B= $opts{"expand"}
ABresult
0X0
100
111
37 {
38 $stack =
39 CIAO::Lib::StackIO::Private::stk_expand_n( $list, $opts{expand} )
40 1 ▶ or croak( __PACKAGE__, ": error generating expanded stack\n" );
Branch: 1 branch
BranchTrueFalseTotal
$stack = CIAO::Lib::StackIO::Private::stk_expand_n($list, $opts{"expand"}) or croak(__PACKAGE__, ": error generating expanded stack\n") 1 0 1
41 }
42 else
43 {
44 5 ▶ $stack = ( exists $opts{prepend} && $opts{prepend} ) ?
Branch: 1 branch
BranchTrueFalseTotal
exists $opts{'prepend'} && $opts{'prepend'} ? : 4 1 5
Condition66%2/3
exists $opts{"prepend"} and $opts{"prepend"}
!ll&&!rl&&r
014
MC/DC50%1/2
exists $opts{"prepend"} and $opts{"prepend"}
exists $opts{"prepend"} $opts{"prepend"}
Truth table66%2/3
A and B
A= exists $opts{"prepend"}B= $opts{"prepend"}
ABresult
0X0
100
111
45 CIAO::Lib::StackIO::Private::stk_build( $list ) :
46 CIAO::Lib::StackIO::Private::stk_build_gen( $list );
47  
48 5 ▶ croak( __PACKAGE__, ": error building stack\n" )
Branch: 1 branch
BranchTrueFalseTotal
unless $stack 0 5 5
49 unless $stack;
50 }
51  
52 # force a stack rewind because of a bug in the stackio library when
53 # creating empty stacks.
54 6 $stack->rewind;
55  
56 6 $stack;
57 }
58  
59  
60 1 1;
61  
62  
63 __END__
↑ Summary StackIO.xs »