Skip to content

Commit 4ef1954

Browse files
committed
Task got on_data field
(borrowed gearman/perl-Gearman-Client#4)
1 parent 5e20b17 commit 4ef1954

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Gearman/Task.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ use fields (
121121
# opts from client:
122122
'uniq',
123123
'on_complete',
124+
'on_data',
124125
'on_fail',
125126
'on_exception',
126127
'on_retry',
@@ -416,6 +417,18 @@ sub status {
416417
$self->{on_status}->($nu, $de);
417418
} ## end sub status
418419

420+
=head2 data()
421+
422+
=cut
423+
424+
sub data {
425+
my Gearman::Task $task = shift;
426+
return if $task->{is_finished};
427+
my $result_ref = shift;
428+
429+
$task->{on_data}->($result_ref) if $task->{on_data};
430+
} ## end sub data
431+
419432
=head2 handle()
420433
421434
getter

0 commit comments

Comments
 (0)