Pipeline/Source.pm

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