| 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') || ''
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')
| |||||||||||||
| 19 | 0 | ▶ | my $teardown_sqls = $reader->get_data_section('teardown') || ''; | ||||||||||
|
Condition0%0/2
$reader->get_data_section('teardown') || ''
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')
| |||||||||||||
| 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
| |||||||||||||
| 33 | } | ||||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 1 | 1; | |||||||||||
| 37 | __END__ | ||||||||||||