blib/lib/Data/Queue/Shared.pm

filter: Statementstmt 91.6% 33 / 36 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 86.9% 40 / 46 CC 4 SCAR 5.7
CC
4
Cov
89%
__ANON__
3.2
__ANON__
2.0
_enable_keywords
2.0
CRAP 1.8
↑ Summary queue.h »
1 package Data::Queue::Shared;
2 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 our $VERSION = '0.12';
5  
6 25 require XSLoader;
7 25 XSLoader::load('Data::Queue::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::Queue::Shared::Int
13 Data::Queue::Shared::Int16
14 Data::Queue::Shared::Int32
15 Data::Queue::Shared::Str
16 ); }
17  
18 # Keyword API hint activation (requires XS::Parse::Keyword)
19 12 ▶sub _enable_keywords {
Subroutine _enable_keywords: called CC=2 SCAR=6.9
20 12 my ($pkg, @kws) = @_;
21 12 $^H{"$pkg/$_"} = 1 for @kws;
22 }
23  
24 25 for my $variant (qw(Int Int32 Int16 Str)) {
25 100 my $lc = lc $variant;
26 100 my $pkg = "Data::Queue::Shared::$variant";
27 100 my @kws = map { "q_${lc}_$_" } qw(push pop peek size);
28 25 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
29 100 ▶ *{"${pkg}::import"} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
30 12 my $class = shift;
31 12 ▶ return unless $Data::Queue::Shared::HAVE_KEYWORDS;
Branch: 1 branch
BranchTrueFalseTotal
unless $Data::Queue::Shared::HAVE_KEYWORDS 0 12 12
32 12 _enable_keywords($pkg, @kws);
33 100 };
34 100 ▶ *{"${pkg}::unimport"} = sub {
Subroutine __ANON__: not called CC=2 SCAR=11.6
35 0 my $class = shift;
36 0 delete $^H{"$pkg/$_"} for @kws;
37 100 };
38 }
39  
40 25 1;
41  
42 __END__
↑ Summary queue.h »