DirWatch/Unmodified.pm

filter: Statementstmt 70.5% 12 / 17 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 51.8% 14 / 27 CC 3 SCAR 20.3
CC
3
Cov
55%
__ANON__
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.6
« DirWatch/Role/AIO.pm ↑ Summary DirWatch.pm »
1 package POE::Component::DirWatch::Unmodified;
2  
3 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = "0.300001";
7  
8 1 extends 'POE::Component::DirWatch';
9 1 with 'POE::Component::DirWatch::Role::Signatures';
10  
11 #--------#---------#---------#---------#---------#---------#---------#---------
12  
13 around _file_callback => sub {
14 0 ▶ my $orig = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
15 0 my ($self, $kernel, $file) = @_[OBJECT, KERNEL, ARG0];
16 0 my $sig = delete $self->signatures->{"$file"};
17 0 ▶ return unless defined $sig && $sig->is_same;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sig and $sig->is_same 0 0 0
Condition0%0/3
defined $sig and $sig->is_same
!ll&&!rl&&r
000
MC/DC0%0/2
defined $sig and $sig->is_same
defined $sig $sig->is_same
Truth table0%0/3
A and B
A= defined $sigB= $sig->is_same
ABresult
0X0
100
111
18 0 $orig->(@_);
19 1 };
20  
21 1 __PACKAGE__->meta->make_immutable;
22  
23 1 1;
24  
25 __END__;
26  
27 #--------#---------#---------#---------#---------#---------#---------#---------
28  
29  
30 =head1 NAME
31  
32 POE::Component::DirWatch::Unmodified
33  
34 =head1 DESCRIPTION
35  
36 POE::Component::DirWatch::Unmodified extends DirWatch::New to
37 exclude files that appear to be in use or are actively being changed. To
38 prevent files from being processed multiple times it is adviced that files
39 are moved after successful processing.
40  
41 This module consumes the L<POE::Component::DirWatch::Role::Signatures> role,
42 please see its documentation for information about methods or attributes
43 it provides or extends.
44  
45 =head1 METHODS
46  
47 =head2 _file_callback
48  
49 C<around '_file_callback'> is modified to only execute the callback if the file
50 has been seen previously and its signature has not changed since the last
51 poll. This behavior means that callbacks will not be called until the second
52 time they are seen.
53  
54 =head2 meta
55  
56 Keeping tests happy.
57  
58 =head1 SEE ALSO
59  
60 L<POE::Component::DirWatch>, L<Moose>
61  
62 =head1 COPYRIGHT
63  
64 Copyright 2006-2008 Guillermo Roditi. This is free software; you may
65 redistribute it and/or modify it under the same terms as Perl itself.
66  
67 =cut
68  
« DirWatch/Role/AIO.pm ↑ Summary DirWatch.pm »