blib/lib/POE/Component/DirWatch/WithCaller.pm

filter: Statementstmt 44.2% 23 / 52 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 55.5% 5 / 9 Podpod n/a totaltotal 25.0% 28 / 112 CC 19 SCAR 55.9
CC
19
Cov
25%
__ANON__
380.0
__ANON__
2.0
__ANON__
2.0
CRAP 267.8
↑ Summary
1 package POE::Component::DirWatch::WithCaller;
2  
3 1 our $VERSION = "1.00";
4  
5 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 extends 'POE::Component::DirWatch';
12  
13 1 has ignore_seen => (
14 is => 'ro',
15 isa => 'Int',
16 required => 1,
17 default => 0,
18 );
19 1 has ensure_seen => (
20 is => 'ro',
21 isa => 'Int',
22 required => 0,
23 default => 0,
24 );
25 has seen_files => (
26 is => 'rw',
27 isa => 'HashRef',
28 0 ▶ default => sub{{}},
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 1 );
30  
31 0 ▶override '_poll' => sub {
Subroutine __ANON__: not called CC=19 SCAR=59.4
32 # the vast majority of this is copied from POE::Component::DirWatch's _poll subroutine by virtue of not being able to call super
33 0 my ($self, $kernel) = @_[OBJECT, KERNEL];
34 0 $self->clear_next_poll;
35  
36 # seen_files portions borrowed from POE::Component::DirWatch::Object::NewFile
37 0 %{ $self->seen_files } = map {$_ => $self->seen_files->{$_} } grep {-e $_ } keys %{ $self->seen_files };
38 0 ▶ my $filter = $self->has_filter ? $self->filter : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->has_filter ? : 0 0 0
39 0 my $has_dir_cb = $self->has_dir_callback;
40 0 my $has_file_cb = $self->has_file_callback;
41  
42 0 ▶ while (my $child = $self->directory->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $child = $self->directory->next) 0 0 0
43 0 ▶ if($child->is_dir) {
Branch: 1 branch
BranchTrueFalseTotal
if ($child->is_dir) { } 0 0 0
44 0 ▶ next unless $has_dir_cb;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_dir_cb 0 0 0
45 0 ▶ next if ref $filter && !$filter->($self->alias, $child);
Branch: 1 branch
BranchTrueFalseTotal
if ref $filter and not &$filter($self->alias, $child) 0 0 0
Condition0%0/3
ref $filter and not &$filter($self->alias, $child)
!ll&&!rl&&r
000
MC/DC0%0/2
ref $filter and not &$filter($self->alias, $child)
ref $filter not &$filter($self->alias, $child)
Truth table0%0/3
A and not(B)
A= ref $filterB= not &$filter($self->alias, $child)
ABresult
0X0
100
111
46 0 $kernel->yield(dir_callback => $child);
47 } else {
48 0 ▶ next unless $has_file_cb;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_file_cb 0 0 0
49 0 ▶ next if $child->basename =~ /^\.+$/;
Branch: 1 branch
BranchTrueFalseTotal
if $child->basename =~ /^\.+$/ 0 0 0
50 0 ▶ $self->seen_files->{"$child"} = 0 if not defined $self->seen_files->{"$child"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->seen_files->{"$child"} 0 0 0
51 0 ▶ next unless $self->seen_files->{"$child"} == 0 or $self->seen_files->{"$child"} > 120 or not $self->ignore_seen;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seen_files->{"$child"} == 0 or $self->seen_files->{"$child"} > 120 or not $self->ignore_seen 0 0 0
Condition0%0/6
$self->seen_files->{"$child"} == 0 or $self->seen_files->{"$child"} > 120 or not $self->ignore_seen
l!l&&r!l&&!r
000
$self->seen_files->{"$child"} == 0 or $self->seen_files->{"$child"} > 120
l!l&&r!l&&!r
000
MC/DC0%0/3
$self->seen_files->{"$child"} == 0 or $self->seen_files->{"$child"} > 120 or not $self->ignore_seen
$self->seen_files->{"$child"} == 0 $self->seen_files->{"$child"} > 120 not $self->ignore_seen
Truth table0%0/4
A or B or not(C)
A= $self->seen_files->{"$child"} == 0B= $self->seen_files->{"$child"} > 120C= not $self->ignore_seen
ABCresult
1XX1
01X1
0011
0000
52 0 ▶ $self->seen_files->{"$child"}++ unless ($self->seen_files->{"$child"}*$self->interval) > 120 and $self->seen_files->{"$child"} = -1;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seen_files->{"$child"} * $self->interval > 120 and $self->seen_files->{"$child"} = -1 0 0 0
Condition0%0/2
$self->seen_files->{"$child"} * $self->interval > 120 and $self->seen_files->{"$child"} = -1
!ll
00
MC/DC0%0/1
$self->seen_files->{"$child"} * $self->interval > 120 and $self->seen_files->{"$child"} = -1
$self->seen_files->{"$child"} * $self->interval > 120
Truth table0%0/2
A
A= $self->seen_files->{"$child"} * $self->interval > 120
Aresult
00
11
53 0 ▶ $self->seen_files->{"$child"} = 1 if $self->ignore_seen and not $self->ensure_seen;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ignore_seen and not $self->ensure_seen 0 0 0
Condition0%0/3
$self->ignore_seen and not $self->ensure_seen
!ll&&!rl&&r
000
MC/DC0%0/2
$self->ignore_seen and not $self->ensure_seen
$self->ignore_seen not $self->ensure_seen
Truth table0%0/3
A and not(B)
A= $self->ignore_seenB= not $self->ensure_seen
ABresult
0X0
100
111
54 0 ▶ next if ref $filter && !$filter->($self->alias, $child);
Branch: 1 branch
BranchTrueFalseTotal
if ref $filter and not &$filter($self->alias, $child) 0 0 0
Condition0%0/3
ref $filter and not &$filter($self->alias, $child)
!ll&&!rl&&r
000
MC/DC0%0/2
ref $filter and not &$filter($self->alias, $child)
ref $filter not &$filter($self->alias, $child)
Truth table0%0/3
A and not(B)
A= ref $filterB= not &$filter($self->alias, $child)
ABresult
0X0
100
111
55 0 $kernel->yield(file_callback => $child);
56 }
57 }
58 0 $self->next_poll( $kernel->delay_set(poll => $self->interval) );
59 1 };
60  
61 0 ▶override '_file_callback' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 my ($self, $kernel, $file) = @_[OBJECT, KERNEL, ARG0];
63 0 $self->file_callback->($self->alias, $file);
64 1 };
65  
66 0 ▶override '_dir_callback' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
67 0 my ($self, $kernel, $dir) = @_[OBJECT, KERNEL, ARG0];
68 0 $self->dir_callback->($self->alias, $dir);
69 1 };
70  
71 1 1;
72 __END__
↑ Summary