| 1 | package Linux::Event::Kernel::Inotify; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | our $VERSION = '0.119'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use Scalar::Util qw(refaddr weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | require Linux::Event::Kernel::Inotify::Event; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | require Linux::Event::Kernel::Inotify::Watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 9 | require Linux::Event::Loop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 9 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 9 | XSLoader::load(__PACKAGE__, $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 9 | IN_ACCESS => 0x00000001, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | IN_MODIFY => 0x00000002, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | IN_ATTRIB => 0x00000004, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | IN_CLOSE_WRITE => 0x00000008, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | IN_CLOSE_NOWRITE => 0x00000010, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | IN_OPEN => 0x00000020, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | IN_MOVED_FROM => 0x00000040, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | IN_MOVED_TO => 0x00000080, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | IN_CREATE => 0x00000100, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | IN_DELETE => 0x00000200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | IN_DELETE_SELF => 0x00000400, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | IN_MOVE_SELF => 0x00000800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | IN_ALL_EVENTS => 0x00000fff, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | IN_UNMOUNT => 0x00002000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | IN_Q_OVERFLOW => 0x00004000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | IN_IGNORED => 0x00008000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | IN_ONLYDIR => 0x01000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | IN_DONT_FOLLOW => 0x02000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | IN_EXCL_UNLINK => 0x04000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | IN_MASK_ADD => 0x20000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | IN_ISDIR => 0x40000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | my @MONITORABLE = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | [on_access => IN_ACCESS], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | [on_modify => IN_MODIFY], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | [on_attrib => IN_ATTRIB], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | [on_close_write => IN_CLOSE_WRITE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | [on_close_nowrite => IN_CLOSE_NOWRITE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | [on_open => IN_OPEN], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | [on_moved_from => IN_MOVED_FROM], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | [on_moved_to => IN_MOVED_TO], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | [on_create => IN_CREATE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | [on_delete => IN_DELETE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | [on_delete_self => IN_DELETE_SELF], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | [on_move_self => IN_MOVE_SELF], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | my @DISPATCH_ORDER = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | [on_create => IN_CREATE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | [on_open => IN_OPEN], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | [on_access => IN_ACCESS], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | [on_modify => IN_MODIFY], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | [on_attrib => IN_ATTRIB], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | [on_close_write => IN_CLOSE_WRITE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | [on_close_nowrite => IN_CLOSE_NOWRITE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | [on_moved_from => IN_MOVED_FROM], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | [on_moved_to => IN_MOVED_TO], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | [on_move_self => IN_MOVE_SELF], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | [on_delete => IN_DELETE], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | [on_delete_self => IN_DELETE_SELF], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | [on_unmount => IN_UNMOUNT], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | [on_ignored => IN_IGNORED], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 9 | my %WATCH_CALLBACK = map { $_->[0] => 1 } @DISPATCH_ORDER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 9 | $WATCH_CALLBACK{on_event} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 9 | my %CLASS_DESCRIPTOR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | my %LIVE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 9 | my $NEXT_ID = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 9 | my $DISPATCH_BUDGET = 256; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 15 | ▶ | sub _class_descriptor ($class) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_descriptor: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 15 | ▶ | return $CLASS_DESCRIPTOR{$class} if exists $CLASS_DESCRIPTOR{$class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 8 | ▶ | croak "$class is not a Linux::Event::Kernel::Inotify subclass" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | if !$class->isa(__PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 8 | return $CLASS_DESCRIPTOR{$class} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | on_overflow => $class->can('on_overflow'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | on_error => $class->can('on_error'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 15 | ▶ | sub _effective_descriptor ($class, $option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_effective_descriptor: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 15 | my %descriptor = %{ _class_descriptor($class) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 15 | for my $name (qw(on_overflow on_error)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 30 | ▶ | next if !exists $option->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | my $callback = delete $option->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | ▶ | croak "new(): $name must be a coderef" if ref($callback) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | $descriptor{$name} = $callback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 15 | return \%descriptor; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 15 | ▶ | sub new ($class, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=22.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 15 | ▶ | croak 'new(): must be called as a class method' if ref $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 15 | my $descriptor = _effective_descriptor($class, \%option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 15 | my $loop = delete $option{loop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 15 | ▶ | croak 'new(): loop must be an object implementing add() and watch()' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
defined $loop and not ref $loop && $loop->can("add") && $loop->can("watch")
ref $loop && $loop->can('add') && $loop->can('watch')
ref $loop and $loop->can("add")
MC/DC0%0/4
defined $loop and not ref $loop && $loop->can("add") && $loop->can("watch")
defined $loop
ref $loop
$loop->can("add")
$loop->can('watch')
Truth table40%2/5
A and not(B and C && D)
A= defined $loopB= ref $loopC= $loop->can("add")D= $loop->can('watch')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | if defined($loop) && (!ref($loop) || !$loop->can('add') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | || !$loop->can('watch')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 15 | my $data = delete $option{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 15 | ▶ | croak 'new(): unknown options: ' . join(', ', sort keys %option) if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 15 | my $id = $NEXT_ID++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 15 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | descriptor => $descriptor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | data => $data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | state => 'unattached', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | terminal => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | loop => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | fd => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | watcher => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | next_watch_id => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | watches => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | watch_order => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | groups => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | group_identity => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | pending_events => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | resume_defer => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 15 | $LIVE{$id} = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 15 | weaken($LIVE{$id}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 15 | ▶ | $loop->add($self) if defined $loop; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 15 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 24 | ▶ | sub _watch_event_mask ($callback) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_watch_event_mask: called CC=6 SCAR=18.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 24 | my $mask = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 24 | for my $entry (@MONITORABLE) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 288 | ▶ | $mask |= $entry->[1] if $callback->{ $entry->[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 24 | ▶ | $mask = IN_ALL_EVENTS if !$mask && $callback->{on_event}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $mask and $callback->{"on_event"}
MC/DC50%1/2
not $mask and $callback->{"on_event"}
not $mask
$callback->{"on_event"}
Truth table66%2/3
not(A) and B
A= not $maskB= $callback->{"on_event"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 24 | ▶ | croak 'watch(): at least one monitorable callback or on_event is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if !$mask; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 24 | return $mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 24 | ▶ | sub watch ($self, $path, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
watch: called CC=20 SCAR=32.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 24 | ▶ | croak 'watch(): Inotify is closed' if $self->{terminal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 24 | ▶ | croak 'watch(): path must be a nonempty scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $path or ref $path or $path eq ""
not defined $path or ref $path
MC/DC0%0/3
not defined $path or ref $path or $path eq ""
not defined $path
ref $path
$path eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $pathB= ref $pathC= $path eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | if !defined($path) || ref($path) || $path eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 24 | ▶ | croak 'watch(): path must not contain NUL' if index($path, "\0") >= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 24 | my %callback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 24 | for my $name (keys %WATCH_CALLBACK) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 360 | ▶ | next if !exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 52 | my $value = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 52 | ▶ | croak "watch(): $name must be a coderef" if ref($value) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 52 | $callback{$name} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 24 | my %flag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 24 | for my $name (qw(only_dir dont_follow excl_unlink)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 72 | ▶ | next if !exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | my $value = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | ▶ | croak "watch(): $name must be 0 or 1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $value or ref $value or not "$value" =~ /\A(?:0|1)\z/u
not defined $value or ref $value
MC/DC0%0/3
not defined $value or ref $value or not "$value" =~ /\A(?:0|1)\z/u
not defined $value
ref $value
not "$value" =~ /\A(?:0|1)\z/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $valueB= ref $valueC= not "$value" =~ /\A(?:0|1)\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | if !defined($value) || ref($value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | || "$value" !~ /\A(?:0|1)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | ▶ | $flag{$name} = $value ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 24 | ▶ | croak 'watch(): unknown options: ' . join(', ', sort keys %option) if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 24 | my $event_mask = _watch_event_mask(\%callback); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 24 | my $absolute = File::Spec->rel2abs($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 24 | my $id = $self->{next_watch_id}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 24 | my $watch = Linux::Event::Kernel::Inotify::Watch->_new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | $self, $id, $absolute, $event_mask, \%callback, \%flag, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 24 | $self->{watches}{$id} = $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 2 | push @{ $self->{watch_order} }, $id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 24 | ▶ | if $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 24 | ▶ | if ($self->{state} eq 'active') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 22 | my $ok = eval { $self->_activate_watch($watch); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 22 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 3 | ▶ | my $error = $@ || 'watch activation failed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$@ || 'watch activation failed'
MC/DC0%0/1
$@ || 'watch activation failed'
$@
Truth table50%1/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 3 | delete $self->{watches}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 3 | $watch->_terminate('failed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 3 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 21 | return $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 15 | ▶ | sub _attach_to_loop ($self, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_attach_to_loop: called CC=12 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | croak 'add(): Inotify is not unattached' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 15 | ▶ | if $self->{terminal} || $self->{state} ne 'unattached' || $self->{loop}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->{"terminal"} or $self->{"state"} ne "unattached" or $self->{"loop"}
$self->{"terminal"} or $self->{"state"} ne "unattached"
MC/DC0%0/3
$self->{"terminal"} or $self->{"state"} ne "unattached" or $self->{"loop"}
$self->{"terminal"}
$self->{"state"} ne "unattached"
$self->{"loop"}
Truth table25%1/4
A or B or C
A= $self->{"terminal"}B= $self->{"state"} ne "unattached"C= $self->{"loop"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 15 | my $fd = _new_fd(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 15 | $self->{fd} = $fd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 15 | $self->{loop} = $loop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 15 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 15 | for my $id (@{ $self->{watch_order} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 3 | ▶ | my $watch = $self->{watches}{$id} // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"watches"}{$id} // (next)
MC/DC0%0/1
$self->{"watches"}{$id} // (next)
$self->{"watches"}{$id}
Truth table50%1/2
A
A= $self->{"watches"}{$id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 3 | ▶ | next if $watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 3 | $self->_activate_watch($watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 14 | $self->{watcher} = $loop->watch( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | fd => $fd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | _internal => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | data => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | read => \&_ready, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | error => \&_source_error, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | _callback_data_arg => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 14 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 15 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | my $error = $@ || 'could not attach Inotify'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$@ || 'could not attach Inotify'
MC/DC0%0/1
$@ || 'could not attach Inotify'
$@
Truth table50%1/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | ▶ | eval { $self->{watcher}->cancel if $self->{watcher}; 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | $self->{watcher} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | eval { _close_fd($fd); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | $self->{fd} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | $self->{loop} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | $self->{groups} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | $self->{group_identity} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | for my $watch (values %{ $self->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | $watch->_reset_pending if $watch->is_active; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 14 | $self->{state} = 'active'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 14 | $self->{watch_order} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 14 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 26 | ▶ | sub _watch_kernel_mask ($watch, $event_mask = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_watch_kernel_mask: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 26 | ▶ | $event_mask = $watch->_event_mask if !defined $event_mask; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 26 | my $mask = $event_mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 26 | ▶ | $mask |= IN_EXCL_UNLINK if $watch->_flag('excl_unlink'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 26 | ▶ | $mask |= IN_ONLYDIR if $watch->_flag('only_dir'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 26 | ▶ | $mask |= IN_DONT_FOLLOW if $watch->_flag('dont_follow'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 26 | return $mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 22 | ▶ | sub _watch_identity ($watch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_watch_identity: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 22 | ▶ | my @stat = $watch->_flag('dont_follow') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ? lstat($watch->path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | : stat($watch->path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 22 | ▶ | return undef if !@stat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 22 | return $stat[0] . ':' . $stat[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 9 | ▶ | sub _forget_group ($self, $group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_forget_group: called CC=6 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | delete $self->{groups}{ $group->{wd} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | if $self->{groups}{ $group->{wd} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 9 | ▶ | && refaddr($self->{groups}{ $group->{wd} }) == refaddr($group); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"groups"}{$group->{"wd"}} and builtin::refaddr($self->{"groups"}{$group->{"wd"}}) == builtin::refaddr($group)
MC/DC0%0/2
$self->{"groups"}{$group->{"wd"}} and builtin::refaddr($self->{"groups"}{$group->{"wd"}}) == builtin::refaddr($group)
$self->{"groups"}{$group->{"wd"}}
builtin::refaddr($self->{"groups"}{$group->{"wd"}}) == builtin::refaddr($group)
Truth table33%1/3
A and B
A= $self->{"groups"}{$group->{"wd"}}B= builtin::refaddr($self->{"groups"}{$group->{"wd"}}) == builtin::refaddr($group)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 9 | my $identity = $group->{identity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | delete $self->{group_identity}{$identity} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | if defined($identity) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | && $self->{group_identity}{$identity} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 9 | ▶ | && refaddr($self->{group_identity}{$identity}) == refaddr($group); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $identity and $self->{"group_identity"}{$identity} and builtin::refaddr($self->{"group_identity"}{$identity}) == builtin::refaddr($group)
defined $identity and $self->{"group_identity"}{$identity}
MC/DC0%0/3
defined $identity and $self->{"group_identity"}{$identity} and builtin::refaddr($self->{"group_identity"}{$identity}) == builtin::refaddr($group)
defined $identity
$self->{"group_identity"}{$identity}
builtin::refaddr($self->{"group_identity"}{$identity}) == builtin::refaddr($group)
Truth table25%1/4
A and B and C
A= defined $identityB= $self->{"group_identity"}{$identity}C= builtin::refaddr($self->{"group_identity"}{$identity}) == builtin::refaddr($group)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 9 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | ▶ | sub _group_union_mask ($group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_group_union_mask: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | my $mask = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | for my $watch (@{ $group->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 2 | ▶ | next if !$watch->is_active; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 2 | $mask |= $watch->_event_mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 2 | return $mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 1 | ▶ | sub _reprogram_group ($self, $group, $event_mask) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reprogram_group: called CC=7 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | ▶ | return 0 if !defined($self->{fd}) || !$event_mask; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"fd"} and $event_mask
MC/DC0%0/2
defined $self->{"fd"} and $event_mask
defined $self->{"fd"}
$event_mask
Truth table33%1/3
A and B
A= defined $self->{"fd"}B= $event_mask
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1 | for my $watch (@{ $group->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | next if !$watch->is_active; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1 | my $wd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 1 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $wd = _add_watch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | $self->{fd}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | $watch->path, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | _watch_kernel_mask($watch, $event_mask), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | next if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ▶ | if ($wd == $group->{wd}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | $group->{kernel_event_mask} = $event_mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # The pathname stopped naming the inode represented by this group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # Remove the accidental new watch and try another surviving alias. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | eval { _rm_watch($self->{fd}, $wd); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # Keeping a kernel-mask superset is safe because logical dispatch still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # filters each record against the surviving Watch objects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 25 | ▶ | sub _activate_watch ($self, $watch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_activate_watch: called CC=11 SCAR=27.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 25 | my $mask = _watch_kernel_mask($watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # IN_MASK_CREATE guarantees that a genuinely new logical subscription | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # cannot overwrite the mask of an inode that this inotify instance already | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # watches. A duplicate inode falls through to the explicit sharing path. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 25 | my $wd = _add_watch_create($self->{fd}, $watch->path, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 22 | ▶ | if (defined $wd) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 19 | my $identity = _watch_identity($watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 19 | ▶ | my $group = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | wd => $wd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | identity => $identity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | excl_unlink => $watch->_flag('excl_unlink') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | kernel_event_mask => $watch->_event_mask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | watches => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 19 | $self->{groups}{$wd} = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 19 | ▶ | $self->{group_identity}{$identity} = $group if defined $identity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 19 | push @{ $group->{watches} }, $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 19 | $watch->_activate($wd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 19 | return $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # The kernel reports that this inode is already watched. Where possible, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # reject incompatible shared-watch policy before changing the kernel mask. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 3 | my $identity = _watch_identity($watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 3 | ▶ | if (defined($identity) && (my $known = $self->{group_identity}{$identity})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $identity and my $known = $self->{"group_identity"}{$identity}
MC/DC0%0/2
defined $identity and my $known = $self->{"group_identity"}{$identity}
defined $identity
my $known = $self->{"group_identity"}{$identity}
Truth table33%1/3
A and B
A= defined $identityB= my $known = $self->{"group_identity"}{$identity}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 3 | ▶ | if (!!$known->{excl_unlink} != !!$watch->_flag('excl_unlink')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | croak 'watch(): excl_unlink must match existing watches for the same inode'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | $wd = _add_watch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | $self->{fd}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | $watch->path, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | $mask | IN_MASK_ADD, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 2 | my $group = $self->{groups}{$wd}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 2 | ▶ | if (!$group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # The pathname changed between the create-only probe and the sharing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # call. Treat the object selected by the second syscall as a new group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $identity = _watch_identity($watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | $group = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | wd => $wd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | identity => $identity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | excl_unlink => $watch->_flag('excl_unlink') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | kernel_event_mask => $watch->_event_mask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | watches => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $self->{groups}{$wd} = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | $self->{group_identity}{$identity} = $group if defined $identity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | elsif (!!$group->{excl_unlink} != !!$watch->_flag('excl_unlink')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # A rare pathname race may bypass the identity precheck. Restore the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # previous logical union before reporting the incompatible request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $self->_reprogram_group($group, $group->{kernel_event_mask}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | croak 'watch(): excl_unlink must match existing watches for the same inode'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 2 | push @{ $group->{watches} }, $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 2 | $group->{kernel_event_mask} |= $watch->_event_mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | $watch->_activate($wd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 2 | return $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 12 | ▶ | sub _ready ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ready: called CC=7 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 12 | ▶ | return if $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 12 | ▶ | if (@{ $self->{pending_events} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $self->_schedule_resume; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 12 | my $events; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 12 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 12 | $events = _read_events($self->{fd}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 12 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | return $self->_runtime_fail($@ || 'inotify read failed'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$@ || 'inotify read failed'
MC/DC0%0/1
$@ || 'inotify read failed'
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 12 | ▶ | push @{ $self->{pending_events} }, @$events if @$events; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 12 | ▶ | $self->_drain_pending if @{ $self->{pending_events} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 14 | ▶ | sub _drain_pending ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_drain_pending: called CC=10 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 14 | my $dispatched = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 14 | ▶ | while ($self->{state} eq 'active' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$self->{"state"} eq "active" and @{$self->{"pending_events"};} and $dispatched < $DISPATCH_BUDGET
$self->{"state"} eq "active" and @{$self->{"pending_events"};}
MC/DC66%2/3
$self->{"state"} eq "active" and @{$self->{"pending_events"};} and $dispatched < $DISPATCH_BUDGET
$self->{"state"} eq "active"
@{$self->{"pending_events"};}
$dispatched < $DISPATCH_BUDGET
Truth table75%3/4
A and B and C
A= $self->{"state"} eq "active"B= @{$self->{"pending_events"};}C= $dispatched < $DISPATCH_BUDGET
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 337 | && @{ $self->{pending_events} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | && $dispatched < $DISPATCH_BUDGET) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 323 | my $record = shift @{ $self->{pending_events} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 323 | $dispatched++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 323 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 323 | $self->_dispatch_record($record); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 323 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 323 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | my $error = $@ || 'Inotify callback failed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$@ || 'Inotify callback failed'
MC/DC0%0/1
$@ || 'Inotify callback failed'
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | $self->_schedule_resume | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | if $self->{state} eq 'active' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | && @{ $self->{pending_events} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"state"} eq "active" and @{$self->{"pending_events"};}
MC/DC0%0/2
$self->{"state"} eq "active" and @{$self->{"pending_events"};}
$self->{"state"} eq "active"
@{$self->{"pending_events"};}
Truth table0%0/3
A and B
A= $self->{"state"} eq "active"B= @{$self->{"pending_events"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | $self->_schedule_resume | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | if $self->{state} eq 'active' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 14 | ▶ | && @{ $self->{pending_events} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"state"} eq "active" and @{$self->{"pending_events"};}
MC/DC50%1/2
$self->{"state"} eq "active" and @{$self->{"pending_events"};}
$self->{"state"} eq "active"
@{$self->{"pending_events"};}
Truth table66%2/3
A and B
A= $self->{"state"} eq "active"B= @{$self->{"pending_events"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 14 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | ▶ | sub _schedule_resume ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_schedule_resume: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | ▶ | return if $self->{resume_defer} || $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"resume_defer"} or $self->{"state"} ne "active"
MC/DC0%0/2
$self->{"resume_defer"} or $self->{"state"} ne "active"
$self->{"resume_defer"}
$self->{"state"} ne "active"
Truth table33%1/3
A or B
A= $self->{"resume_defer"}B= $self->{"state"} ne "active"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 1 | my $loop = $self->{loop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 1 | ▶ | return if !$loop; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | ▶ | $self->{resume_defer} = $loop->defer(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | $self->{resume_defer} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | ▶ | return if $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 1 | $self->_drain_pending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 1 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 325 | ▶ | sub _record_relevant ($watch, $mask) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_record_relevant: called CC=8 SCAR=30.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 325 | ▶ | return 1 if $mask & $watch->_event_mask; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 1 | ▶ | return 1 if ($mask & IN_UNMOUNT) && $watch->_callback('on_unmount'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mask & 8192 and $watch->_callback("on_unmount")
MC/DC0%0/2
$mask & 8192 and $watch->_callback("on_unmount")
$mask & 8192
$watch->_callback("on_unmount")
Truth table33%1/3
A and B
A= $mask & 8192B= $watch->_callback("on_unmount")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | ▶ | return 1 if ($mask & IN_IGNORED) && $watch->_callback('on_ignored'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mask & 32768 and $watch->_callback("on_ignored")
MC/DC0%0/2
$mask & 32768 and $watch->_callback("on_ignored")
$mask & 32768
$watch->_callback("on_ignored")
Truth table33%1/3
A and B
A= $mask & 32768B= $watch->_callback("on_ignored")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | return 1 if ($mask & (IN_UNMOUNT | IN_IGNORED)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mask & 40960 and $watch->_callback("on_event")
MC/DC0%0/2
$mask & 40960 and $watch->_callback("on_event")
$mask & 40960
$watch->_callback("on_event")
Truth table0%0/3
A and B
A= $mask & 40960B= $watch->_callback("on_event")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | && $watch->_callback('on_event'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 329 | ▶ | sub _dispatch_record ($self, $record) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dispatch_record: called CC=25 SCAR=32.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 329 | my ($wd, $mask, $cookie, $name) = @$record; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 329 | ▶ | if ($mask & IN_Q_OVERFLOW) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | my $callback = $self->{descriptor}{on_overflow}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | ▶ | if ($callback) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | $callback->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | die "Linux::Event Inotify queue overflow\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 328 | ▶ | my $group = $self->{groups}{$wd} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"groups"}{$wd} // (return)
MC/DC100%1/1
$self->{"groups"}{$wd} // (return)
$self->{"groups"}{$wd}
Truth table100%2/2
A
A= $self->{"groups"}{$wd}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 325 | my $ignored = !!($mask & IN_IGNORED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 325 | ▶ | $self->_forget_group($group) if $ignored; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 325 | my @watch = @{ $group->{watches} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 325 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 325 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | WATCH: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 325 | for my $watch (@watch) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 326 | ▶ | last WATCH if $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 326 | ▶ | next WATCH if !$watch->is_active || $watch->_wd != $wd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $watch->is_active or $watch->_wd != $wd
MC/DC50%1/2
not $watch->is_active or $watch->_wd != $wd
not $watch->is_active
$watch->_wd != $wd
Truth table66%2/3
not(A) or B
A= not $watch->is_activeB= $watch->_wd != $wd
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 325 | ▶ | next WATCH if !_record_relevant($watch, $mask); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 325 | my $event = Linux::Event::Kernel::Inotify::Event->_new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | $watch, $name, $mask, $cookie, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 325 | for my $entry (@DISPATCH_ORDER) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 4522 | ▶ | last if !$watch->is_active || $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $watch->is_active or $self->{"state"} ne "active"
MC/DC50%1/2
not $watch->is_active or $self->{"state"} ne "active"
not $watch->is_active
$self->{"state"} ne "active"
Truth table66%2/3
not(A) or B
A= not $watch->is_activeB= $self->{"state"} ne "active"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 4520 | my ($callback_name, $bit) = @$entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 4520 | ▶ | next if !($mask & $bit); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 338 | ▶ | my $callback = $watch->_callback($callback_name) // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$watch->_callback($callback_name) // (next)
MC/DC100%1/1
$watch->_callback($callback_name) // (next)
$watch->_callback($callback_name)
Truth table100%2/2
A
A= $watch->_callback($callback_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 335 | $callback->($event); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 324 | ▶ | next WATCH if !$watch->is_active || $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $watch->is_active or $self->{"state"} ne "active"
MC/DC50%1/2
not $watch->is_active or $self->{"state"} ne "active"
not $watch->is_active
$self->{"state"} ne "active"
Truth table66%2/3
not(A) or B
A= not $watch->is_activeB= $self->{"state"} ne "active"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 322 | my $catch_all = $watch->_callback('on_event'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 322 | ▶ | $catch_all->($event) if $catch_all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 324 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 325 | ▶ | $error = $@ if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 325 | ▶ | if ($ignored) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 2 | for my $watch (@watch) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | next if !$watch->is_active || $watch->_wd != $wd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $watch->is_active or $watch->_wd != $wd
MC/DC0%0/2
not $watch->is_active or $watch->_wd != $wd
not $watch->is_active
$watch->_wd != $wd
Truth table33%1/3
not(A) or B
A= not $watch->is_activeB= $watch->_wd != $wd
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | delete $self->{watches}{ $watch->_id }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | $watch->_terminate('ignored'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 325 | ▶ | die $error if defined($error) && length($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $error and length $error
MC/DC50%1/2
defined $error and length $error
defined $error
length $error
Truth table66%2/3
A and B
A= defined $errorB= length $error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 324 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | sub _source_error ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_source_error: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | return if $self->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | return $self->_runtime_fail("Linux::Event Inotify event source failed\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | ▶ | sub _runtime_fail ($self, $error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_runtime_fail: called CC=5 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | my $callback = $self->{descriptor}{on_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | ▶ | if ($callback) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 1 | $callback->($self, "$error"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | my $callback_error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | ▶ | $self->close if !$self->{terminal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | ▶ | die $callback_error if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | $self->close if !$self->{terminal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 9 | ▶ | sub _cancel_watch ($self, $watch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cancel_watch: called CC=12 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 9 | ▶ | return $watch if $watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 9 | my $wd = $watch->_wd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 9 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 9 | delete $self->{watches}{ $watch->_id }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | if ($self->{state} ne 'active' && @{ $self->{watch_order} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"state"} ne "active" and @{$self->{"watch_order"};}
MC/DC0%0/2
$self->{"state"} ne "active" and @{$self->{"watch_order"};}
$self->{"state"} ne "active"
@{$self->{"watch_order"};}
Truth table33%1/3
A and B
A= $self->{"state"} ne "active"B= @{$self->{"watch_order"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | my $id = $watch->_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | @{ $self->{watch_order} } = grep { $_ != $id } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | @{ $self->{watch_order} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 9 | ▶ | if (defined $wd && $self->{state} eq 'active') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $wd and $self->{"state"} eq "active"
MC/DC0%0/2
defined $wd and $self->{"state"} eq "active"
defined $wd
$self->{"state"} eq "active"
Truth table33%1/3
A and B
A= defined $wdB= $self->{"state"} eq "active"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 9 | my $group = $self->{groups}{$wd}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 9 | ▶ | if ($group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 9 | @{ $group->{watches} } = grep { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 11 | $_->_id != $watch->_id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 9 | } @{ $group->{watches} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 9 | ▶ | if (!@{ $group->{watches} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 7 | $self->_forget_group($group); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 7 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 7 | _rm_watch($self->{fd}, $wd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 7 | ▶ | $error = $@ if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 2 | my $union = _group_union_mask($group); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | $self->_reprogram_group($group, $union) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 2 | ▶ | if $union != $group->{kernel_event_mask}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 9 | $watch->_terminate('cancelled'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 9 | ▶ | die $error if defined($error) && length($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $error and length $error
MC/DC0%0/2
defined $error and length $error
defined $error
length $error
Truth table33%1/3
A and B
A= defined $errorB= length $error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 9 | return $watch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 3 | ▶ | sub _fork_preflight ($self, $mode, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fork_preflight: called CC=8 SCAR=26.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | croak 'fork(): Inotify is not active in this Loop' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | if $self->{terminal} || $self->{state} ne 'active' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 3 | ▶ | || !$self->{loop} || refaddr($self->{loop}) != refaddr($loop); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$self->{"terminal"} or $self->{"state"} ne "active" or not $self->{"loop"} or builtin::refaddr($self->{"loop"}) != builtin::refaddr($loop)
$self->{"terminal"} or $self->{"state"} ne "active" or not $self->{"loop"}
$self->{"terminal"} or $self->{"state"} ne "active"
MC/DC0%0/4
$self->{"terminal"} or $self->{"state"} ne "active" or not $self->{"loop"} or builtin::refaddr($self->{"loop"}) != builtin::refaddr($loop)
$self->{"terminal"}
$self->{"state"} ne "active"
not $self->{"loop"}
builtin::refaddr($self->{"loop"}) != builtin::refaddr($loop)
Truth table20%1/5
A or B or not(C) or D
A= $self->{"terminal"}B= $self->{"state"} ne "active"C= not $self->{"loop"}D= builtin::refaddr($self->{"loop"}) != builtin::refaddr($loop)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 3 | ▶ | croak "fork(): Inotify does not support '$mode'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$mode ne "drop" and $mode ne "clone" and $mode ne "move"
$mode ne "drop" and $mode ne "clone"
MC/DC0%0/3
$mode ne "drop" and $mode ne "clone" and $mode ne "move"
$mode ne "drop"
$mode ne "clone"
$mode ne "move"
Truth table50%2/4
A and B and C
A= $mode ne "drop"B= $mode ne "clone"C= $mode ne "move"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | if $mode ne 'drop' && $mode ne 'clone' && $mode ne 'move'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | sub _fork_child_clone ($self, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fork_child_clone: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $self->{watcher} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | $self->{resume_defer} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | if (defined(my $fd = delete $self->{fd})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | _close_fd($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $self->{pending_events} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | $self->{groups} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $self->{group_identity} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | my @order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | for my $id (sort { $a <=> $b } keys %{ $self->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my $watch = $self->{watches}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | next if !$watch || $watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $watch or $watch->is_terminal
MC/DC0%0/2
not $watch or $watch->is_terminal
not $watch
$watch->is_terminal
Truth table0%0/3
not(A) or B
A= not $watchB= $watch->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $watch->_reset_pending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | push @order, $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $self->{watch_order} = \@order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $self->{loop} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $self->{state} = 'unattached'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $self->_attach_to_loop($loop); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub _fork_child_move ($self, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fork_child_move: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $self->{watcher} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $self->{resume_defer} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | $self->{loop} = $loop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | my $fd = $self->{fd}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | croak 'fork(): inherited Inotify fd is unavailable' if !defined $fd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $self->{watcher} = $loop->watch( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | fd => $fd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | _internal => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | data => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | read => \&_ready, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | error => \&_source_error, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | _callback_data_arg => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | $self->_schedule_resume if @{ $self->{pending_events} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | sub _fork_child_drop ($self, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fork_child_drop: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | $self->{watcher} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $self->{resume_defer} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | if (defined(my $fd = delete $self->{fd})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | _close_fd($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | for my $watch (values %{ $self->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | $watch->_terminate('not_inherited') if !$watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $self->{pending_events} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | $self->{groups} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $self->{group_identity} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | $self->{watch_order} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $self->{loop} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | $self->{state} = 'not_inherited'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | $self->{terminal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | delete $LIVE{ $self->{id} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | ▶ | sub _fork_parent_move ($self, $child_pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fork_parent_move: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 1 | ▶ | if (my $defer = delete $self->{resume_defer}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | eval { $defer->cancel; 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | ▶ | if (my $watcher = delete $self->{watcher}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | $watcher->cancel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | ▶ | if (defined(my $fd = delete $self->{fd})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 1 | _close_fd($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 1 | for my $watch (values %{ $self->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 1 | ▶ | $watch->_terminate('moved') if !$watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 1 | $self->{pending_events} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 1 | $self->{groups} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | $self->{group_identity} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 1 | $self->{watch_order} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 1 | $self->{loop} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 1 | $self->{state} = 'moved'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | $self->{terminal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | delete $LIVE{ $self->{id} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 14 | ▶ | sub close ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=10 SCAR=23.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 14 | ▶ | return $self if $self->{terminal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 14 | ▶ | if (my $defer = delete $self->{resume_defer}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | eval { $defer->cancel; 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 14 | ▶ | if (my $watcher = delete $self->{watcher}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 13 | eval { $watcher->cancel; 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 14 | my $close_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 14 | ▶ | if (defined(my $fd = delete $self->{fd})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 13 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 13 | _close_fd($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 13 | ▶ | $close_error = $@ if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 14 | for my $watch (values %{ $self->{watches} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 9 | ▶ | $watch->_terminate('closed') if !$watch->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 14 | $self->{watches} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 14 | $self->{watch_order} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 14 | $self->{groups} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 14 | $self->{group_identity} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 14 | $self->{pending_events} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 14 | $self->{loop} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 14 | $self->{data} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 14 | $self->{descriptor} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 14 | $self->{state} = 'closed'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 14 | $self->{terminal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 14 | delete $LIVE{ $self->{id} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 14 | ▶ | die $close_error if defined($close_error) && length($close_error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $close_error and length $close_error
MC/DC0%0/2
defined $close_error and length $close_error
defined $close_error
length $close_error
Truth table33%1/3
A and B
A= defined $close_errorB= length $close_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 14 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 43 | ▶ | sub loop ($self) { $self->{terminal} ? undef : $self->{loop} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loop: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 12 | ▶ | sub fd ($self) { $self->{state} eq 'active' ? $self->{fd} : undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fd: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 8 | ▶ | sub state ($self) { $self->{state} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
state: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 5 | ▶ | sub is_active ($self) { $self->{state} eq 'active' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_active: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 46 | ▶ | sub is_terminal ($self) { !!$self->{terminal} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_terminal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 10 | ▶ | sub watch_count ($self) { scalar keys %{ $self->{watches} } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
watch_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | sub data ($self, @argument) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | croak 'data(): Inotify is closed' if $self->{terminal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ▶ | $self->{data} = $argument[0] if @argument; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | return $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 55 | ▶ | sub _objects_for_loop ($class, $loop) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_objects_for_loop: called CC=7 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 55 | my @object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 55 | for my $id (keys %LIVE) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 35 | ▶ | my $object = $LIVE{$id} // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$LIVE{$id} // (next)
MC/DC0%0/1
$LIVE{$id} // (next)
$LIVE{$id}
Truth table50%1/2
A
A= $LIVE{$id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 35 | ▶ | next if $object->{terminal} || $object->{state} ne 'active'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$object->{"terminal"} or $object->{"state"} ne "active"
MC/DC0%0/2
$object->{"terminal"} or $object->{"state"} ne "active"
$object->{"terminal"}
$object->{"state"} ne "active"
Truth table33%1/3
A or B
A= $object->{"terminal"}B= $object->{"state"} ne "active"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | next if !$object->{loop} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 35 | ▶ | || refaddr($object->{loop}) != refaddr($loop); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $object->{"loop"} or builtin::refaddr($object->{"loop"}) != builtin::refaddr($loop)
MC/DC0%0/2
not $object->{"loop"} or builtin::refaddr($object->{"loop"}) != builtin::refaddr($loop)
not $object->{"loop"}
builtin::refaddr($object->{"loop"}) != builtin::refaddr($loop)
Truth table33%1/3
not(A) or B
A= not $object->{"loop"}B= builtin::refaddr($object->{"loop"}) != builtin::refaddr($loop)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 35 | push @object, $object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 55 | return \@object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | sub CLONE ($class) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | %CLASS_DESCRIPTOR = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | %LIVE = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | sub CLONE_SKIP ($class) { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 15 | ▶ | sub DESTROY ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 15 | ▶ | eval { $self->close if !$self->{terminal}; 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 15 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||