File Coverage

blib/lib/Sub/Disable.pm
Criterion Covered Total %
statement 18 18 100.0
branch 6 6 100.0
condition 8 8 100.0
subroutine 3 3 100.0
pod n/a
total 35 35 100.0


line stmt bran cond sub pod time code
1             package Sub::Disable;
2 10     10   145977 use 5.014;
  10         33  
3 10     10   43 use strict;
  10         14  
  10         1810  
4              
5             our $VERSION = '1.01';
6              
7             require XSLoader;
8             XSLoader::load('Sub::Disable', $VERSION);
9              
10             sub import {
11 11     11   59 my $class = shift;
12 11 100       89 return unless scalar @_;
13              
14 9 100       31 my $args = ref($_[0]) eq 'HASH' ? $_[0] : (scalar grep {ref $_} @_) ? {@_} : {any => \@_};
  11 100       31  
15 9         16 my $caller = caller;
16              
17 9   100     9 for my $func (@{$args->{method} // []}, @{$args->{any} // []}) {
  9   100     52  
  9         53  
18 7         28 disable_method_call($caller, $func);
19             }
20              
21 9   100     15 for my $func (@{$args->{sub} // []}, @{$args->{any} // []}) {
  9   100     29  
  9         2484  
22 9         6122 disable_named_call($caller, $func);
23             }
24             }
25              
26             1;
27             __END__