| 1 | # | ||||||||||
| 2 | # $Id: Worker.pm,v 008243d3e89a 2018/07/21 14:54:07 gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::SinFP3::Worker; | ||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use base qw(Class::Gomor::Array); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | our @AS = qw( | |||||||||
| 10 | global | ||||||||||
| 11 | callback | ||||||||||
| 12 | ); | ||||||||||
| 13 | 2 | __PACKAGE__->cgBuildIndices; | |||||||||
| 14 | 2 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 15 | |||||||||||
| 16 | 2 | our %EXPORT_TAGS = ( | |||||||||
| 17 | consts => [qw( | ||||||||||
| 18 | NS_WORKER_SUCCESS | ||||||||||
| 19 | NS_WORKER_FAIL | ||||||||||
| 20 | )], | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | our @EXPORT_OK = ( | ||||||||||
| 24 | 2 | @{$EXPORT_TAGS{consts}}, | |||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 2 | ▶ | use constant NS_WORKER_FAIL => 0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 2 | ▶ | use constant NS_WORKER_SUCCESS => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 31 | 0 | my $self = shift->SUPER::new( | |||||||||
| 32 | @_, | ||||||||||
| 33 | ); | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if (!defined($self->global)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | die("[-] ".__PACKAGE__.": You must provide a global attribute\n"); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | my $log = $self->global->log; | |||||||||
| 40 | |||||||||||
| 41 | 0 | my ($model) = caller(); | |||||||||
| 42 | 0 | $log->verbose("Will use [$model] as worker model"); | |||||||||
| 43 | |||||||||||
| 44 | 0 | return $self; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 48 | 0 | my $self = shift; | |||||||||
| 49 | 0 | my %h = @_; | |||||||||
| 50 | |||||||||||
| 51 | 0 | $self->callback($h{callback}); | |||||||||
| 52 | |||||||||||
| 53 | 0 | return $self; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | 0 | my $self = shift; | |||||||||
| 58 | 0 | return $self; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub post { | ||||||||
|
Subroutine
post: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 0 | my $self = shift; | |||||||||
| 63 | 0 | return $self; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 0 | ▶ | sub clean { | ||||||||
|
Subroutine
clean: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 67 | 0 | my $self = shift; | |||||||||
| 68 | 0 | return $self; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 2 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||