blib/lib/Data/PubSub/Shared.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 90.2% 37 / 41 CC 3 SCAR 4.1
CC
3
Cov
94%
__ANON__
2.5
_enable_keywords
2.0
BEGIN
1.0
CRAP 1.5
↑ Summary Shared.xs »
1 package Data::PubSub::Shared;
2 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 28 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 28 our $VERSION = '0.12';
5  
6 28 require XSLoader;
7 28 XSLoader::load('Data::PubSub::Shared', $VERSION);
8  
9 # ithreads: blessed shared-memory handles must never be cloned into a
10 # child thread -- the clone would double-free the handle on thread exit.
11 0 ▶{ no strict 'refs'; *{"${_}::CLONE_SKIP"} = sub { 1 } for qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
12 Data::PubSub::Shared::Int
13 Data::PubSub::Shared::Int::Sub
14 Data::PubSub::Shared::Int16
15 Data::PubSub::Shared::Int16::Sub
16 Data::PubSub::Shared::Int32
17 Data::PubSub::Shared::Int32::Sub
18 Data::PubSub::Shared::Str
19 Data::PubSub::Shared::Str::Sub
20 ); }
21  
22 7 ▶sub _enable_keywords {
Subroutine _enable_keywords: called CC=2 SCAR=6.9
23 7 my ($pkg, @kws) = @_;
24 7 $^H{"$pkg/$_"} = 1 for @kws;
25 }
26  
27 28 for my $variant (qw(Int Int32 Int16 Str)) {
28 112 my $lc = lc $variant;
29 112 my $pkg = "Data::PubSub::Shared::$variant";
30 112 my @kws = map { "ps_${lc}_$_" } qw(publish poll lag);
31 28 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
32 112 ▶ *{"${pkg}::import"} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 7 _enable_keywords($pkg, @kws);
34 112 };
35 112 ▶ *{"${pkg}::unimport"} = sub {
Subroutine __ANON__: not called CC=2 SCAR=9.2
36 0 delete $^H{"$pkg/$_"} for @kws;
37 112 };
38 }
39  
40 28 1;
41  
42 __END__
↑ Summary Shared.xs »