Object/Touched.pm

filter: Statementstmt 100% 26 / 26 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 97.4% 38 / 39 CC 4 SCAR 7.9
CC
4
Cov
97%
__ANON__
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Object.pm ↑ Summary Object/NewFile.pm »
1 package POE::Component::DirWatch::Object::Touched;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Array::Compare;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 our $VERSION = "0.1200";
9  
10 3 extends 'POE::Component::DirWatch::Object::NewFile';
11  
12 has 'cmp' => (is => 'rw', isa => 'Object', required => 1,
13 1 ▶ default => sub{ Array::Compare->new } );
Subroutine __ANON__: called CC=1 SCAR=0.0
14  
15 #--------#---------#---------#---------#---------#---------#---------#---------#
16  
17 #Remind me of stat:
18 # 7 size total size of file, in bytes
19 # 8 atime last access time in seconds since the epoch
20 # 9 mtime last modify time in seconds since the epoch
21 # 10 ctime inode change time in seconds since the epoch (*)
22  
23 #clean seen files from dispatch list
24  
25 12 ▶override '_dispatch' => sub{
Subroutine __ANON__: called CC=4 SCAR=13.9
26 12 my ($self, $kernel, $fname,$fpath) = @_[OBJECT, KERNEL, ARG0, ARG1];
27  
28 12 ▶ if( exists $self->seen_files->{ $fpath } ){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->seen_files->{$fpath}) 10 2 12
29 10 ▶ return if $self->cmp->compare( $self->seen_files->{ $fpath },
Branch: 1 branch
BranchTrueFalseTotal
if $self->cmp->compare($self->seen_files->{$fpath}, [(stat $fpath)[7..10]]) 9 1 10
30 [ ( stat($fpath) )[7..10] ]);
31 }
32  
33 3 $self->seen_files->{$fpath} = [ ( stat($fpath) )[7..10] ];
34 3 ▶ $kernel->yield(callback => [$fname, $fpath])
Branch: 1 branch
BranchTrueFalseTotal
if $self->filter->($fname, $fpath) 3 0 3
35 if $self->filter->($fname,$fpath);
36 3 };
37  
38  
39 3 1;
40  
41 __END__;
« Object.pm ↑ Summary Object/NewFile.pm »