File Coverage

blib/lib/Exporter/AutoClean.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Exporter::AutoClean;
2 2     2   5366 use strict;
  2         4  
  2         65  
3 2     2   9 use warnings;
  2         6  
  2         49  
4 2     2   1782 use B::Hooks::EndOfScope;
  2         16110  
  2         14  
5              
6             our $VERSION = '0.01';
7              
8             sub export {
9 2     2 1 221 my $class = shift;
10 2         10 my $pkg = shift;
11 2         6 my %exports = @_;
12              
13 2     2   508 no strict 'refs';
  2         4  
  2         274  
14 2         15 while (my ($name, $code) = each %exports) {
15 2         7 *{"${pkg}::${name}"} = $code;
  2         14  
16             }
17              
18             on_scope_end {
19 2     2   80 for my $name (keys %exports) {
20 2         4 delete ${ $pkg . '::' }{ $name };
  2         12  
21             }
22 2         16 };
23             }
24              
25             1;
26              
27             __END__