| 1 | package Devel::Probe; | ||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use XSLoader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 8 | our $VERSION = '0.000006'; | |||||||||||||||||||||||||||
| 10 | 8 | XSLoader::load( 'Devel::Probe', $VERSION ); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 8 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 8 | my ($class) = @_; | |||||||||||||||||||||||||||
| 14 | 8 | Devel::Probe::install(); | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 8 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 8 | NONE => 0, | |||||||||||||||||||||||||||
| 19 | ONCE => 1, | ||||||||||||||||||||||||||||
| 20 | PERMANENT => 2, | ||||||||||||||||||||||||||||
| 21 | 8 | }; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 5 | ▶ | sub config { | ||||||||||||||||||||||||||
|
Subroutine
config: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 5 | my ($config) = @_; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 5 | Devel::Probe::disable(); | |||||||||||||||||||||||||||
| 27 | 5 | ▶ | return unless $config; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 5 | foreach my $action (@{ $config->{actions} }) { | |||||||||||||||||||||||||||
| 30 | 21 | ▶ | if ($action->{action} eq 'enable') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 4 | Devel::Probe::enable(); | |||||||||||||||||||||||||||
| 32 | 4 | next; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 17 | ▶ | if ($action->{action} eq 'disable') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 1 | Devel::Probe::disable(); | |||||||||||||||||||||||||||
| 36 | 1 | next; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 16 | ▶ | if ($action->{action} eq 'clear') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 1 | Devel::Probe::clear(); | |||||||||||||||||||||||||||
| 40 | 1 | next; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 15 | ▶ | if ($action->{action} eq 'define') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 15 | my $file = $action->{file}; | |||||||||||||||||||||||||||
| 44 | 15 | ▶ | next unless $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 15 | ▶ | my $type = $action->{type} // ONCE; | ||||||||||||||||||||||||||
|
Condition100%2/2
$action->{"type"} // 1
MC/DC100%1/1
$action->{"type"} // 1
$action->{"type"}
Truth table100%2/2
A
A= $action->{"type"}
| |||||||||||||||||||||||||||||
| 47 | 15 | my $argument = $action->{argument}; | |||||||||||||||||||||||||||
| 48 | 15 | ▶ | foreach my $line (@{ $action->{lines} // [] }) { | ||||||||||||||||||||||||||
|
Condition100%2/2
$action->{"lines"} // []
MC/DC100%1/1
$action->{"lines"} // []
$action->{"lines"}
Truth table100%2/2
A
A= $action->{"lines"}
| |||||||||||||||||||||||||||||
| 49 | 21 | add_probe($file, $line, $type, $argument); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 15 | next; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 21021 | ▶ | sub add_probe { | ||||||||||||||||||||||||||
|
Subroutine
add_probe: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 21021 | my ($file, $line, $type, $argument) = @_; | |||||||||||||||||||||||||||
| 58 | 21021 | ▶ | if ($type ne ONCE && $type ne PERMANENT) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type ne 1 and $type ne 2
MC/DC0%0/2
$type ne 1 and $type ne 2
$type ne 1
$type ne 2
Truth table66%2/3
A and B
A= $type ne 1B= $type ne 2
| |||||||||||||||||||||||||||||
| 59 | 0 | croak sprintf("'%s' is not a valid probe type: try Devel::Probe::ONCE|PERMANENT", $type); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 21021 | my $probes = Devel::Probe::_internal_probe_state(); | |||||||||||||||||||||||||||
| 63 | 21021 | ▶ | $probes->{$file}->{$line} = [$type, defined $argument ? $argument : ()]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | ▶ | sub dump { | ||||||||||||||||||||||||||
|
Subroutine
dump: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 67 | 1 | return dclone(Devel::Probe::_internal_probe_state()); | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 8 | 1; | |||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||