File Coverage

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


line stmt bran cond sub pod time code
1             package Sub::Disable;
2 10     10   220591 use 5.014;
  10         29  
  10         421  
3 10     10   49 use strict;
  10         15  
  10         2144  
4              
5             our $VERSION = '1.00';
6              
7             require XSLoader;
8             XSLoader::load('Sub::Disable', $VERSION);
9              
10             sub import {
11 11     11   68 my $class = shift;
12 11 100       109 return unless scalar @_;
13              
14 9 100       38 my $args = ref($_[0]) eq 'HASH' ? $_[0] : (scalar grep {ref $_} @_) ? {@_} : {any => \@_};
  11 100       39  
15 9         21 my $caller = caller;
16              
17 9   100     12 for my $func (@{$args->{method} // []}, @{$args->{any} // []}) {
  9   100     53  
  9         65  
18 7         30 disable_method_call($caller, $func);
19             }
20              
21 9   100     30 for my $func (@{$args->{sub} // []}, @{$args->{any} // []}) {
  9   100     41  
  9         3146  
22 9         7298 disable_named_call($caller, $func);
23             }
24             }
25              
26             1;
27             __END__