| 1 | package Acme::AtIncPolice; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | our $VERSION = "0.01"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Tie::Trace qw/watch/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | *Tie::Trace::_output_message = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | my ($self, $class, $value, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=23 SCAR=44.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | if (!$value) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | my ($msg, @msg) = (''); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | my $caller = $self->{options}->{caller}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my $_caller_n = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | while (my $c = (caller $_caller_n)[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | ▶ | if (not $c) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } elsif ($c !~ /^Tie::Trace/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | $_caller_n++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | my @caller = map $_ + $_caller_n, ref $caller ? @{$caller} : $caller; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | my(@filename, @line); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | foreach(@caller){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | my($f, $l) = (caller($_))[1, 2]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | next unless $f and $l; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$f and $l
MC/DC0%0/2
$f and $l
$f
$l
Truth table33%1/3
A and B
A= $fB= $l
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | push @filename, $f; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | push @line, $l; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | my $location = @line == 1 ? " at $filename[0] line $line[0]." : | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | join "\n", map " at $filename[$_] line $line[$_].", (0 .. $#filename); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | my($_p, $p) = ($self, $self->parent); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | while($p){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $s_type = ref $p->{storage}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $s = $p->{storage}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if($s_type eq 'HASH'){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | push @msg, "{$_p->{__key}}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | }elsif($s_type eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | push @msg, "[$_p->{__point}]"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $_p = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | last if ! ref $p or ! ($p = $p->parent); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $p and $p = $p->parent
MC/DC0%0/2
ref $p and $p = $p->parent
ref $p
$p = $p->parent
Truth table0%0/3
A and B
A= ref $pB= $p = $p->parent
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | $msg = @msg > 0 ? ' => ' . join "", reverse @msg : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | if ($class eq 'Scalar') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return("${msg} => $value$location"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } elsif ($class eq 'Array') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | unless(defined $args->{point}){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | $msg =~ s/^( => )(.+)$/$1\@\{$2\}/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | return("$msg => $value$location"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return("${msg}[$args->{point}] => $value$location"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } elsif ($class eq 'Hash') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | return("${msg}" . (! $self->{options}->{pkg} || @msg ? "" : " => "). "{$args->{key}} => $value$location"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->{"options"}{"pkg"} or @msg
MC/DC0%0/2
not $self->{"options"}{"pkg"} or @msg
not $self->{"options"}{"pkg"}
@msg
Truth table0%0/3
not(A) or B
A= not $self->{"options"}{"pkg"}B= @msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | *Tie::Trace::_carpit = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=46.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | ▶ | return if $Tie::Trace::QUIET; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | my $class = (split /::/, ref $self)[2]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | ▶ | my $op = $self->{options} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'options'} || {}
MC/DC0%0/1
$self->{'options'} || {}
$self->{'options'}
Truth table50%1/2
A
A= $self->{'options'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # key/value checking | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | ▶ | if ($op->{key} or $op->{value}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$op->{"key"} or $op->{"value"}
MC/DC0%0/2
$op->{"key"} or $op->{"value"}
$op->{"key"}
$op->{"value"}
Truth table33%1/3
A or B
A= $op->{"key"}B= $op->{"value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $key = $self->_matching($self->{options}->{key}, $args{key}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $value = $self->_matching($self->{options}->{value}, $args{value}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if (($args{key} and $op->{key}) and $op->{value}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/6
$args{"key"} and $op->{"key"} and $op->{"value"}
$args{"key"} and $op->{"key"}
MC/DC0%0/3
$args{"key"} and $op->{"key"} and $op->{"value"}
$args{"key"}
$op->{"key"}
$op->{"value"}
Truth table0%0/4
A and B and C
A= $args{"key"}B= $op->{"key"}C= $op->{"value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | return unless $key or $value; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key or $value
MC/DC0%0/2
$key or $value
$key
$value
Truth table0%0/3
A or B
A= $keyB= $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ▶ | } elsif($args{key} and $op->{key}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{"key"} and $op->{"key"}
MC/DC0%0/2
$args{"key"} and $op->{"key"}
$args{"key"}
$op->{"key"}
Truth table0%0/3
A and B
A= $args{"key"}B= $op->{"key"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | return unless $key; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } elsif($op->{value}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return unless $value; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # debug type | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | my $value = $self->_debug_message($args{value}, $op->{debug}, $args{filter}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # debug_value checking | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | ▶ | return unless $self->_matching($self->{options}->{debug_value}, $value); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # use scalar/array/hash ? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | return unless grep lc($class) eq lc($_) , @{$op->{use}}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # create warning message | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | my $watch_msg = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | my $msg = $self->_output_message($class, $value, \%args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | if(defined $self->{options}->{pkg}){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $watch_msg = sprintf("%s:: %s", @{$self->{options}}{qw/pkg var/}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | ▶ | $msg =~ s/^ => // if $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | ▶ | if ($msg) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | croak $watch_msg . $msg . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | watch @INC, ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | debug => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | ▶ | my ($self, $things) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | for my $thing (@$things) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | my $ref = ref($thing); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | if ($ref) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | return "Acme::AtIncPolice does not allow contamination of \@INC"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | r => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||