File Coverage

blib/lib/POE/Component/DirWatch/Modified.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package POE::Component::DirWatch::Modified;
2              
3 2     2   149573 use POE;
  2         3  
  2         10  
4 2     2   1653 use Moose;
  0            
  0            
5              
6             our $VERSION = "0.300002";
7              
8             extends 'POE::Component::DirWatch';
9             with 'POE::Component::DirWatch::Role::Signatures';
10              
11             #--------#---------#---------#---------#---------#---------#---------#---------
12              
13             around '_file_callback' => sub {
14             my $orig = shift;
15             my ($self, $file) = @_[OBJECT, ARG0];
16             my $sigs = $self->signatures;
17             my $new_sig = $self->_generate_signature($file);
18             return if exists $sigs->{"$file"} && $sigs->{"$file"} eq $new_sig;
19             $sigs->{"$file"} = $new_sig;
20             return $orig->(@_);
21             };
22              
23             __PACKAGE__->meta->make_immutable;
24              
25             1;
26              
27             __END__;
28              
29             #--------#---------#---------#---------#---------#---------#---------#---------
30              
31              
32             =head1 NAME
33              
34             POE::Component::DirWatch::Modified
35              
36             =head1 DESCRIPTION
37              
38             POE::Component::DirWatch::Modified extends DirWatch::New in order to exclude
39             files that have already been seen, but still pick up files that have been
40             changed. Usage is identical to L<POE::Component::DirWatch>.
41              
42             This module consumes the L<POE::Component::DirWatch::Role::Signatures> role,
43             please see its documentation for information about methods or attributes
44             it provides or extends.
45              
46             =head1 METHODS
47              
48             =head2 _file_callback
49              
50             C<override '_file_callback'> Don't call the callback if file has been seen
51             before and is unchanged.
52              
53             =head2 meta
54              
55             See L<Moose>
56              
57             =head1 SEE ALSO
58              
59             L<POE::Component::DirWatch::New>, L<POE::Component::DirWatch>
60              
61             =head1 COPYRIGHT
62              
63             Copyright 2006-2008 Guillermo Roditi. This is free software; you may
64             redistribute it and/or modify it under the same terms as Perl itself.
65              
66             =cut
67