File Coverage

blib/lib/B/Hooks/OP/Check/EntersubForCV.pm
Criterion Covered Total %
statement 29 29 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 40 41 97.5


line stmt bran cond sub pod time code
1 2     2   125126 use strict;
  2         6  
  2         68  
2 2     2   13 use warnings;
  2         5  
  2         115  
3              
4             package B::Hooks::OP::Check::EntersubForCV;
5              
6 2     2   638 use parent qw/DynaLoader/;
  2         571  
  2         22  
7 2     2   841 use B::Hooks::OP::Check 0.19;
  2         1076  
  2         68  
8 2     2   14 use Scalar::Util qw/refaddr/;
  2         5  
  2         108  
9 2     2   828 use B::Utils 0.19 ();
  2         10871  
  2         501  
10              
11             our $VERSION = '0.10';
12              
13 2     2 1 237 sub dl_load_flags { 0x01 }
14              
15             __PACKAGE__->bootstrap($VERSION);
16              
17             my %CALLBACKS;
18              
19             sub import {
20 2     2   28 my $class = shift;
21              
22 2 50       17 die 'odd number of arguments'
23             unless @_ % 2 == 0;
24              
25 2         9 while (@_) {
26 3         15 my ($cv, $cb) = (shift, shift);
27 3         45 $CALLBACKS{ refaddr $cv } = register($cv, $cb);
28             }
29              
30 2         50 return;
31             }
32              
33             sub unimport {
34 1     1   3947 my $class = shift;
35              
36 1         3 unregister($_) for delete @CALLBACKS{ map { refaddr $_ } @_ };
  1         14  
37 1         34 return;
38             }
39              
40             1;
41              
42             __END__