| 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
| |||||||||||
| 29 | 10 | ▶ | return if $self->cmp->compare( $self->seen_files->{ $fpath }, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 35 | if $self->filter->($fname,$fpath); | ||||||||||
| 36 | 3 | }; | |||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 3 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__; | ||||||||||