1package AnyEvent::Gearman::Job; 2use Any::Moose; 3 4extends 'AnyEvent::Gearman::Task'; 5 6no Any::Moose; 7 8sub complete { 9 my ($self, $result) = @_; 10 $self->event( on_complete => $result ); 11} 12 13sub data { 14 my ($self, $data) = @_; 15 $self->event( on_data => $data ); 16} 17 18sub fail { 19 my ($self) = @_; 20 $self->event('on_fail'); 21} 22 23sub status { 24 my ($self, $numerator, $denominator) = @_; 25 $self->event( on_status => $numerator, $denominator ); 26} 27 28sub warning { 29 my ($self, $warning) = @_; 30 $self->event( on_warning => $warning ); 31} 32 33__PACKAGE__->meta->make_immutable; 34 35__END__ 36 37=head1 NAME 38 39AnyEvent::Gearman::Job - gearman job 40 41=head1 SYNOPSIS 42 43 $job->complete($result); 44 $job->data($data); 45 $job->fail; 46 $job->status($numerator, $denominator); 47 $job->warning($warning); 48 49=head1 METHODS 50 51=head2 complete($result) 52 53=head2 data($data) 54 55=head2 fail 56 57=head2 status($numerator, $denominator) 58 59=head2 warning($warning) 60 61=head1 AUTHOR 62 63Daisuke Murase <typester@cpan.org> 64 65Pedro Melo <melo@cpan.org> 66 67=head1 COPYRIGHT AND LICENSE 68 69Copyright (c) 2009 by KAYAC Inc. 70 71This program is free software; you can redistribute 72it and/or modify it under the same terms as Perl itself. 73 74The full text of the license can be found in the 75LICENSE file included with this module. 76 77=cut 78