| 1 | package Gearman::Driver::Adaptor::PP; | ||
| 2 | |||
| 3 | 13 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 13 | ▶ | use Gearman::Worker; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 13 | has 'worker' => ( | |
| 7 | builder => '_build_worker', | ||
| 8 | is => 'ro', | ||
| 9 | isa => 'Gearman::Worker', | ||
| 10 | ); | ||
| 11 | |||
| 12 | 18 | ▶ | sub _build_worker { |
|
Subroutine
_build_worker: called CC=1 SCAR=0.0
| |||
| 13 | 18 | return Gearman::Worker->new; | |
| 14 | } | ||
| 15 | |||
| 16 | 18 | ▶ | sub add_servers { |
|
Subroutine
add_servers: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 17 | 18 | my ( $self, $server ) = @_; | |
| 18 | 18 | my @server = split /,/, $server; | |
| 19 | 18 | $self->worker->job_servers(@server); | |
| 20 | } | ||
| 21 | |||
| 22 | 38 | ▶ | sub add_function { |
|
Subroutine
add_function: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 23 | 38 | my ( $self, $name, $sub ) = @_; | |
| 24 | 38 | $self->worker->register_function( $name => $sub ); | |
| 25 | } | ||
| 26 | |||
| 27 | 1 | ▶ | sub work { |
|
Subroutine
work: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 28 | 1 | my ($self) = @_; | |
| 29 | 1 | while (1) { | |
| 30 | 1 | $self->worker->work; | |
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | 2 | ▶ | *Gearman::Job::workload = sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 35 | 2 | return shift->arg; | |
| 36 | 13 | }; | |
| 37 | |||
| 38 | 0 | ▶ | *Gearman::Job::function_name = sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 39 | 0 | return shift->{func}; | |
| 40 | 13 | }; | |
| 41 | |||
| 42 | 13 | 1; | |