| 1 | package AnyEvent::Inotify::EventReceiver::Callback; | ||
| 2 | 1 | $AnyEvent::Inotify::EventReceiver::Callback::VERSION = '0.04'; | |
| 3 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | #use namespace::autoclean; | ||
| 5 | |||
| 6 | 3 | ▶ | use MooseX::Types::Moose qw(CodeRef); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | has 'callback' => ( | |
| 9 | traits => ['Code'], | ||
| 10 | is => 'ro', | ||
| 11 | isa => CodeRef, | ||
| 12 | required => 1, | ||
| 13 | handles => { | ||
| 14 | call_callback => 'execute', | ||
| 15 | }, | ||
| 16 | ); | ||
| 17 | |||
| 18 | 1 | for my $event (qw/access modify attribute_change close open move delete create/){ | |
| 19 | 3 | ▶ | __PACKAGE__->meta->add_method( "handle_$event" => sub { |
|
Subroutine
handle_create: called CC=1 SCAR=0.0
Subroutine
handle_move: called CC=1 SCAR=0.0
Subroutine
handle_access: called CC=1 SCAR=0.0
| |||
| 20 | 3 | my $self = shift; | |
| 21 | 3 | $self->call_callback($event, @_); | |
| 22 | 8 | }); | |
| 23 | } | ||
| 24 | |||
| 25 | 1 | with 'AnyEvent::Inotify::EventReceiver'; | |
| 26 | |||
| 27 | 1 | 1; | |
| 28 | |||
| 29 | __END__ | ||