/usr/share/perl5/Gearman/Job.pm is in libgearman-client-perl 2.004.012-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | package Gearman::Job;
use version ();
$Gearman::Job::VERSION = version->declare("2.004.012");
use strict;
use warnings;
use Gearman::Util ();
use Carp ();
=head1 NAME
Gearman::Job - Job in gearman distributed job system
=head1 DESCRIPTION
I<Gearman::Job> is the object that's handed to the worker subrefs
=head1 METHODS
=cut
use fields (
'func',
'argref',
'handle',
# job server's socket
'jss',
# job server
'js',
);
sub new {
my ($self, %arg) = @_;
unless (ref $self) {
$self = fields::new($self);
}
while(my ($k, $v) = each(%arg)) {
$self->{$k} = $v;
}
return $self;
} ## end sub new
=head2 set_status($numerator, $denominator)
Updates the status of the job (most likely, a long-running job) and sends
it back to the job server. I<$numerator> and I<$denominator> should
represent the percentage completion of the job.
=cut
sub set_status {
my $self = shift;
my ($nu, $de) = @_;
my $req = Gearman::Util::pack_req_command("work_status",
join("\0", $self->{handle}, $nu, $de));
Carp::croak "work_status write failed"
unless Gearman::Util::send_req($self->{jss}, \$req);
return 1;
} ## end sub set_status
=head2 argref()
=cut
sub argref {
return shift->{argref};
}
=head2 arg()
B<return> the scalar argument that the client sent to the job server.
=cut
sub arg {
return ${ shift->{argref} };
}
=head2 handle()
B<return> handle
=cut
sub handle {
return shift->{handle};
}
1;
|