Pipeline/Source.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 100% 32 / 32 CC 2 SCAR 2.0
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Pipeline/Factories.pm ↑ Summary Pipeline/Gather.pm »
1 15 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Ekorn::Pipeline::Source;
4  
5 15 ▶use parent 'Ekorn::Pipeline::Element';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 15 ▶use Ref::Util qw(is_coderef);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Ekorn::Pipeline::Errors qw(croakf);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # Croak at the line that called Ekorn::Pipeline.
12 15 our @CARP_NOT = @Ekorn::Pipeline::Errors::INTERNAL;
13  
14 # Return a source made afresh for each run by the set-up given, which
15 # returns the source's step and, optionally, its end and a context for
16 # the run. Called directly, it croaks: a run of its own would never be
17 # ended, so what it opened would stay open.
18 294 ▶sub new ($class, $setup) {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
19 294 ▶ croakf 'Expected a code reference' unless is_coderef($setup);
Branch: 1 branch
BranchTrueFalseTotal
unless Ref::Util::XS::is_coderef($setup) 2 292 294
20 return bless {
21 setup => $setup,
22 1 ▶ call => sub { croakf 'Expected a source to be read through iterator' },
Subroutine __ANON__: called CC=1 SCAR=0.0
23 292 }, $class;
24 }
25  
26  
27 # Return what the set-up returns for a new run: the step, and
28 # optionally the end and a context.
29 289 ▶sub EKORN_SOURCE ($self) {
Subroutine EKORN_SOURCE: called CC=1 SCAR=0.0
Pod documented
30 289 return $self->{setup}->();
31 }
32  
33 15 1;
34  
35 __END__
« Pipeline/Factories.pm ↑ Summary Pipeline/Gather.pm »