| 1 | package App::ppll::Worker; ## no critic [NamingConventions::Capitalization] | ||||||||||
| 2 | |||||||||||
| 3 | =encoding utf8 | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | App::ppll::Worker | ||||||||||
| 8 | |||||||||||
| 9 | =head1 VERSION | ||||||||||
| 10 | |||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||
| 12 | |||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | 2 | ▶ | use autodie; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ▶ | use utf8::all; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 2 | ▶ | use v5.20; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | use IPC::Run qw( harness new_chunker ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 2 | ▶ | use experimental qw( signatures ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 2 | ▶ | use overload '""' => 'str'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | =head1 SUBROUTINES/METHODS | ||||||||||
| 29 | |||||||||||
| 30 | =head2 new | ||||||||||
| 31 | |||||||||||
| 32 | Constructor. | ||||||||||
| 33 | |||||||||||
| 34 | Named parameters: | ||||||||||
| 35 | |||||||||||
| 36 | =over | ||||||||||
| 37 | |||||||||||
| 38 | =item argv | ||||||||||
| 39 | |||||||||||
| 40 | =item prefix | ||||||||||
| 41 | |||||||||||
| 42 | =back | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | 1 | ▶ | sub new ( $class, %self ) { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||
| 47 | 1 | my @harness_args = ( $self{argv} ); | |||||||||
| 48 | |||||||||||
| 49 | push @harness_args, ( '>', new_chunker, $self{out} ) | ||||||||||
| 50 | 1 | ▶ | if $self{out}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | |||||||||||
| 52 | push @harness_args, ( '2>', new_chunker, $self{err} ) | ||||||||||
| 53 | 1 | ▶ | if $self{err}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | |||||||||||
| 55 | 1 | $self{harness} = harness( @harness_args ); | |||||||||
| 56 | |||||||||||
| 57 | 1 | return bless \%self, $class; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | =head2 result | ||||||||||
| 61 | |||||||||||
| 62 | =cut | ||||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | sub result( $self ) { | ||||||||
|
Subroutine
result: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 65 | 0 | ▶ | if ( $self->{harness}->pumpable ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | $self->{harness}->pump_nb; | |||||||||
| 67 | 0 | return; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 0 | $self->{harness}->finish; | |||||||||
| 71 | 0 | $self->{finished} = 1; | |||||||||
| 72 | 0 | my $result = $self->{harness}->result; | |||||||||
| 73 | |||||||||||
| 74 | 0 | return $result; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | =head2 start | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | 0 | ▶ | sub start( $self ) { | ||||||||
|
Subroutine
start: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 82 | 0 | $self->{harness}->start; | |||||||||
| 83 | 0 | return; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | =head2 stop | ||||||||||
| 87 | |||||||||||
| 88 | =cut | ||||||||||
| 89 | |||||||||||
| 90 | 0 | ▶ | sub stop( $self ) { | ||||||||
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 91 | 0 | $self->{harness}->kill_kill; | |||||||||
| 92 | 0 | $self->{harness}->finish; | |||||||||
| 93 | 0 | $self->{finished} = 1; | |||||||||
| 94 | 0 | return; | |||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | =head2 str | ||||||||||
| 98 | |||||||||||
| 99 | =cut | ||||||||||
| 100 | |||||||||||
| 101 | 1 | ▶ | sub str ( $self, @ ) { | ||||||||
|
Subroutine
str: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 102 | 1 | return $self->{parameter}; | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 106 | |||||||||||
| 107 | Copyright 2019 Theo Willows. | ||||||||||
| 108 | |||||||||||
| 109 | This program is free software; you can redistribute it and/or modify it under | ||||||||||
| 110 | the terms of either: the GNU General Public License as published by the Free | ||||||||||
| 111 | Software Foundation; or the Artistic License. | ||||||||||
| 112 | |||||||||||
| 113 | See L<http://dev.perl.org/licenses/> for more information. | ||||||||||
| 114 | |||||||||||
| 115 | =cut | ||||||||||
| 116 | |||||||||||
| 117 | 2 | 1; | |||||||||