Pipeline/Stop.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 100% 26 / 26 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Pipeline/Errors.pm ↑ Summary Pipeline/Tooling.pm »
1 29 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Ekorn::Pipeline::Stop;
4  
5 29 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 29 ▶use namespace::clean -except => 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 ▶use overload '""' => sub { "Stop used outside a pipeline\n" }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
10  
11 29 our $VERSION = 'v0.3.16';
12  
13 29 our @EXPORT = qw(Stop); ## no critic (Modules::ProhibitAutomaticExportation)
14  
15 # Syntactic sugar throwing the exception that stops a pipeline early.
16 140 ▶sub Stop (@data) {
Subroutine Stop: called CC=1 SCAR=0.0
Pod documented
17 140 return __PACKAGE__->throw(@data);
18 }
19  
20 # Throws an exception that stops a pipeline early.
21 #
22 # It's thrown with die, not croak, though croak is our rule for what we
23 # pass on. Given an object, croak dies with it unchanged, adding no
24 # location, so it gives catchers nothing die doesn't; but it does
25 # Carp's work first, which made a stop about three times dearer: 1.4
26 # microseconds against 0.42, as DBIx-Squirrel measured on 2026-11-14,
27 # on Perl 5.36 and 5.44.
28 331 ▶sub throw ($class, @data) {
Subroutine throw: called CC=1 SCAR=0.0
Pod documented
29 331 die bless([$class, @data], $class); ## no critic (ErrorHandling::RequireCarping)
30 }
31  
32 29 1;
33 __END__
« Pipeline/Errors.pm ↑ Summary Pipeline/Tooling.pm »