| 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
| |||||||||||
| 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__ | ||||||||||