File Coverage

lib/Devel/Trepan/DB/Use.pm
Criterion Covered Total %
statement 13 17 76.4
branch 1 4 25.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 19 27 70.3


line stmt bran cond sub pod time code
1             package Devel::Trepan::DB::Use;
2             =head1 SUMMARY
3              
4             A callback hook for L<Devel::Trepan>'s when I<use> gets called.
5              
6             =cut
7              
8 2     2   15 use File::Basename; use File::Spec;
  2     2   39  
  2         124  
  2         12  
  2         41  
  2         75  
9              
10             BEGIN {
11 2     2   142 unshift @INC, \&use_hook;
12             };
13              
14             sub use_hook {
15 175     175 0 586422 my ($coderef, $filename) = @_; # $coderef is \&my_sub
16             ## FIXME: allow for calling the debugger on "use".
17             # print "++use_hook ", $filename, "\n";
18 175 50       531 if ($filename eq 'SelfLoader.pm') {
19 0         0 my $dirname = dirname(__FILE__);
20 0         0 my $SelfLoader_file = File::Spec->catfile($dirname, 'SelfLoader.pm');
21 2     2   12 no strict 'refs';
  2         4  
  2         177  
22 0 0       0 open(FH, '<', $SelfLoader_file) or return undef;
23 0         0 return *FH;
24             }
25             return undef
26 175         104679 }
27              
28             1;