| 1 | # | ||||||||||
| 2 | # $Id: Output.pm,v 008243d3e89a 2018/07/21 14:54:07 gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::SinFP3::Output; | ||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use base qw(Class::Gomor::Array); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | our @AS = qw( | |||||||||
| 10 | global | ||||||||||
| 11 | ); | ||||||||||
| 12 | 1 | __PACKAGE__->cgBuildIndices; | |||||||||
| 13 | 1 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 16 | 0 | my $self = shift->SUPER::new( | |||||||||
| 17 | @_, | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | if (!defined($self->global)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | die("[-] ".__PACKAGE__.": You must provide a global object\n"); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | return $self; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub take { | ||||||||
|
Subroutine
take: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 0 | return []; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | # Launched before first fork() on all modules | ||||||||||
| 32 | 0 | ▶ | sub preInit { | ||||||||
|
Subroutine
preInit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | 0 | my $self = shift; | |||||||||
| 34 | 0 | return $self; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | # Launched only by job == 1, but we don't know when. | ||||||||||
| 38 | 0 | ▶ | sub firstInit { | ||||||||
|
Subroutine
firstInit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 39 | 0 | my $self = shift; | |||||||||
| 40 | |||||||||||
| 41 | 0 | my $global = $self->global; | |||||||||
| 42 | 0 | my $log = $global->log; | |||||||||
| 43 | 0 | my $job = $global->job; | |||||||||
| 44 | |||||||||||
| 45 | # Execute only if we are job == 1 | ||||||||||
| 46 | 0 | ▶ | if ($job == 1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | return $self; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | return; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 54 | 0 | my $self = shift; | |||||||||
| 55 | |||||||||||
| 56 | 0 | my $log = $self->global->log; | |||||||||
| 57 | |||||||||||
| 58 | 0 | my $take = $self->take; | |||||||||
| 59 | # By default we take all objects | ||||||||||
| 60 | 0 | ▶ | if (@$take == 0) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | return $self; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 0 | my @result = $self->global->result; | |||||||||
| 65 | 0 | for my $r (@result) { | |||||||||
| 66 | 0 | my $ref = ref($r); | |||||||||
| 67 | 0 | my $found; | |||||||||
| 68 | 0 | for my $t (@$take) { | |||||||||
| 69 | 0 | ▶ | if ($ref =~ /^$t/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | $found++; | |||||||||
| 71 | 0 | last; | |||||||||
| 72 | } | ||||||||||
| 73 | } | ||||||||||
| 74 | 0 | ▶ | if (! $found) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | 0 | $log->error("Result type [$ref] not allowed with this plugin"); | |||||||||
| 76 | 0 | return; | |||||||||
| 77 | } | ||||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 0 | return $self; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 84 | 0 | my $self = shift; | |||||||||
| 85 | 0 | return $self; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | sub post { | ||||||||
|
Subroutine
post: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 89 | 0 | my $self = shift; | |||||||||
| 90 | 0 | return $self; | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | 0 | ▶ | sub lastPost { | ||||||||
|
Subroutine
lastPost: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 94 | 0 | my $self = shift; | |||||||||
| 95 | 0 | return $self; | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | 1 | 1; | |||||||||
| 99 | |||||||||||
| 100 | __END__ | ||||||||||