Pipeline/Stage.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 6 / 6 Conditioncond 83.3% 5 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 11 / 11 Podpod 100% 3 / 3 totaltotal 96.6% 58 / 60 CC 6 SCAR 10.6
CC
6
Cov
98%
new
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Pipeline/Feed.pm ↑ Summary Pipeline/Iterator.pm »
1 27 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Ekorn::Pipeline::Stage;
4  
5 27 ▶use parent 'Ekorn::Pipeline::Element';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 27 ▶use experimental qw(builtin);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 27 ▶use builtin qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 27 ▶use overload qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 27 ▶use Ref::Util qw(is_coderef);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 27 ▶use Ekorn::Pipeline::Errors qw(croakf);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 27 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # Croak at the line that called Ekorn::Pipeline.
15 27 our @CARP_NOT = @Ekorn::Pipeline::Errors::INTERNAL;
16  
17 # Return a stage of the code given, which is kept as it is, never
18 # blessed: a code reference, or an object called as one that isn't
19 # itself one of Ekorn's types. An object's code is found once, here, as
20 # a run takes a step that's a code reference.
21 915 ▶sub new ($class, $code) {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
22 915 ▶ my $callable
Condition83%5/6
Ref::Util::XS::is_coderef($code) || builtin::blessed($code) && overload::Method($code, '&{}')
l!l&&r!l&&!r
91122
builtin::blessed($code) and overload::Method($code, "&{}")
!ll&&!rl&&r
202
MC/DC66%2/3
Ref::Util::XS::is_coderef($code) || builtin::blessed($code) && overload::Method($code, '&{}')
Ref::Util::XS::is_coderef($code) builtin::blessed($code) overload::Method($code, "&{}")
Truth table75%3/4
A || B and C
A= Ref::Util::XS::is_coderef($code)B= builtin::blessed($code)C= overload::Method($code, "&{}")
ABCresult
1XX1
0111
00X0
0100
23 = is_coderef($code) || (blessed($code) && overload::Method($code, '&{}'));
24 915 ▶ croakf 'Expected a code reference' unless $callable;
Branch: 1 branch
BranchTrueFalseTotal
unless $callable 2 913 915
25 913 ▶ croakf q(Expected a code reference, not one of Ekorn's types)
Branch: 1 branch
BranchTrueFalseTotal
if $code isa "Ekorn::Pipeline::Element" 1 912 913
26 if $code isa 'Ekorn::Pipeline::Element';
27 912 ▶ return bless {call => is_coderef($code) ? $code : \&$code, code => $code},
Branch: 1 branch
BranchTrueFalseTotal
Ref::Util::XS::is_coderef($code) ? : 911 1 912
28 $class;
29 }
30  
31  
32 # Return the code the stage was made of.
33 5 ▶sub code ($self) {
Subroutine code: called CC=1 SCAR=0.0
Pod documented
34 5 return $self->{code};
35 }
36  
37  
38 # Return the stage's step for a new run: its code, as a code reference.
39 566 ▶sub EKORN_STAGE ($self) {
Subroutine EKORN_STAGE: called CC=1 SCAR=0.0
Pod documented
40 566 return $self->{call};
41 }
42  
43 27 1;
44  
45 __END__
« Pipeline/Feed.pm ↑ Summary Pipeline/Iterator.pm »