blib/lib/DBIx/Squirrel/Stages/Taps.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/DBIx/Squirrel/Stages/Flow.pm ↑ Summary blib/lib/DBIx/Squirrel/Stop.pm »
1 5 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package DBIx::Squirrel::Stages::Taps;
4  
5 5 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 ▶use Ekorn::Pipeline::Stages::Taps qw(peek count_into dump_to tee);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 our $VERSION = 'v4.2.0';
10  
11 # A plain re-export of Ekorn::Pipeline::Stages::Taps's functions, from
12 # DBIx::Squirrel's own list of them, imported from it by name, so a name
13 # Ekorn::Pipeline drops fails here, as the module loads, and one it adds
14 # isn't exported until it's listed here.
15 5 our @EXPORT = qw(peek count_into); ## no critic (Modules::ProhibitAutomaticExportation)
16 5 our @EXPORT_OK = (@EXPORT, qw(dump_to tee));
17 5 our %EXPORT_TAGS = (all => \@EXPORT_OK);
18  
19 # True, dump_to writes each value in full, without redacting secrets.
20 # It's Ekorn::Pipeline's $DumpSecrets, which dump_to reads, under
21 # DBIx::Squirrel's name, so a caller needn't name Ekorn's package
22 # (roadmap 2026-0062).
23 #
24 # Why a tie, and not an alias, *DumpSecrets = \$Ekorn::...::DumpSecrets?
25 # Because callers set it with local, as they set Data::Dumper's, and
26 # local on an aliased package variable gives our name a fresh value of
27 # its own for the scope: Ekorn's never sees it, and dump_to goes on
28 # redacting. Through the tie, every read and write, local's included,
29 # goes to Ekorn's variable, and local puts Ekorn's value back as its
30 # scope ends. dump_to reads Ekorn's directly, so the tie costs nothing
31 # while dumping.
32 5 our $DumpSecrets; ## no critic (Variables::ProhibitPackageVars)
33 5 tie $DumpSecrets, 'DBIx::Squirrel::Stages::Taps::DumpSecretsTie';
34  
35 # The tie: each read and write goes to Ekorn::Pipeline's variable.
36 package ## no critic (Modules::ProhibitMultiplePackages) its name on the next line, hidden from PAUSE
37 5 DBIx::Squirrel::Stages::Taps::DumpSecretsTie {
38  
39  
40 5 ▶ sub TIESCALAR ($class) {
Subroutine TIESCALAR: called CC=1 SCAR=0.0
41 5 my $unused;
42 5 return bless \$unused, $class;
43 }
44  
45  
46 2 ▶ sub FETCH ($self) {
Subroutine FETCH: called CC=1 SCAR=0.0
47 2 return $Ekorn::Pipeline::Stages::Taps::DumpSecrets; ## no critic (Variables::ProhibitPackageVars) the variable it stands for
48 }
49  
50  
51 5 ▶ sub STORE ($self, $value) {
Subroutine STORE: called CC=1 SCAR=0.0
52 5 $Ekorn::Pipeline::Stages::Taps::DumpSecrets = $value; ## no critic (Variables::ProhibitPackageVars) the variable it stands for
53 5 return;
54 }
55 }
56  
57 5 1;
58 __END__
« blib/lib/DBIx/Squirrel/Stages/Flow.pm ↑ Summary blib/lib/DBIx/Squirrel/Stop.pm »