| 1 | 4 | ▶ | use v5.36; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Ekorn::Pipeline::Pipes; | ||
| 4 | |||
| 5 | 4 | ▶ | use Ekorn::Pipeline qw(); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 4 | our $VERSION = 'v0.4.0'; | |
| 8 | |||
| 9 | # Return what a run of the stages gives, the invocant its one value, as | ||
| 10 | # a pipeline of them called with it gives it, in either context: what | ||
| 11 | # comes out of the last stage; in scalar context, how many did, or a | ||
| 12 | # sink's result. | ||
| 13 | 29 | ▶ | sub pipe ($self, @stages) { ## no critic (Subroutines::ProhibitBuiltinHomonyms) |
|
Subroutine
pipe: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | 29 | return Ekorn::Pipeline->new(@stages)->($self); | |
| 15 | } | ||
| 16 | |||
| 17 | # Run the invocant through a pipeline of stages for their side effects, and | ||
| 18 | # return the invocant. | ||
| 19 | 10 | ▶ | sub tap ($self, @stages) { |
|
Subroutine
tap: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | 10 | my $pipeline = Ekorn::Pipeline->new(@stages); | |
| 21 | 9 | $pipeline->($self); | |
| 22 | 8 | return $self; | |
| 23 | } | ||
| 24 | |||
| 25 | 4 | 1; | |
| 26 | __END__ | ||