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   13 use File::Basename; use File::Spec;
  2     2   4  
  2         131  
  2         11  
  2         4  
  2         59  
9              
10             BEGIN {
11 2     2   126 unshift @INC, \&use_hook;
12             };
13              
14             sub use_hook {
15 224     224 0 544112 my ($coderef, $filename) = @_; # $coderef is \&my_sub
16             ## FIXME: allow for calling the debugger on "use".
17             # print "++use_hook ", $filename, "\n";
18 224 50       773 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   11 no strict 'refs';
  2         4  
  2         128  
22 0 0       0 open(FH, '<', $SelfLoader_file) or return undef;
23 0         0 return *FH;
24             }
25             return undef
26 224         122137 }
27              
28             1;