blib/lib/Data/Section/Fixture.pm

filter: Statementstmt 62.5% 20 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 6 / 9 Podpod 100% 1 / 1 totaltotal 54.0% 27 / 50 CC 5 SCAR 18.2
CC
5
Cov
53%
with_fixture
12.0
_exec_sqls
12.0
__ANON__
2.0
CRAP 6.2
↑ Summary
1 package Data::Section::Fixture;
2 1 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 Data::Section::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Scope::Guard;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = "0.01";
10  
11 1 our @EXPORT_OK = qw(with_fixture);
12  
13 0 ▶sub with_fixture ($&) {
Subroutine with_fixture: not called CC=3 SCAR=24.8
Pod documented
14 0 my ($dbh, $code) = @_;
15  
16 0 my ($pkg) = caller;
17 0 my $reader = Data::Section::Simple->new($pkg);
18 0 ▶ my $setup_sqls = $reader->get_data_section('setup') || '';
Condition0%0/2
$reader->get_data_section('setup') || ''
l!l
00
MC/DC0%0/1
$reader->get_data_section('setup') || ''
$reader->get_data_section('setup')
Truth table0%0/2
A
A= $reader->get_data_section('setup')
Aresult
11
00
19 0 ▶ my $teardown_sqls = $reader->get_data_section('teardown') || '';
Condition0%0/2
$reader->get_data_section('teardown') || ''
l!l
00
MC/DC0%0/1
$reader->get_data_section('teardown') || ''
$reader->get_data_section('teardown')
Truth table0%0/2
A
A= $reader->get_data_section('teardown')
Aresult
11
00
20  
21 0 ▶ my $guard = Scope::Guard->new(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 _exec_sqls($dbh, $teardown_sqls);
23 0 });
24 0 _exec_sqls($dbh, $setup_sqls);
25  
26 0 $code->();
27 }
28  
29 0 ▶sub _exec_sqls {
Subroutine _exec_sqls: not called CC=3 SCAR=24.8
30 0 my ($dbh, $sqls) = @_;
31 0 for (split ';', $sqls) {
32 0 ▶ $dbh->do($_) unless $_ =~ /^\s+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_ =~ /^\s+$/ 0 0 0
33 }
34 }
35  
36 1 1;
37 __END__
↑ Summary