lib/DB/Hooks/TraceLoad.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 1 SCAR 6.9
CC
1
Cov
0%
load_handler
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package DB::Hooks::TraceLoad;
2  
3 use strict;
4 use warnings;
5  
6 use IO::Handle;
7 open my $stat, ">load.info";
8 $stat->autoflush(1);
9  
10  
11 sub load_handler {
12 # DB::stop;
13 my( $what ) = @_;
14 $what =~ s/\*main::_<//;
15  
16 # Find a module name by a file name
17 $what = (grep{ ($INC{$_}//'') eq $what } keys %INC)[0] // 'UNKNOWN';
18 $what =~ s!/!::!g;
19 $what =~ s!\.pm$!!;
20  
21 my $from = (caller(6))[0] // 'UNKNOWN';
22 $stat->print( "$what << $from\n" );
23  
24 # DB::say "\n\n\n>>>>>>>>>>>>>Loaded '@_'<<<<<<<<<<<<<<<<\n\n\n";
25 }
26  
27 DB::on( load => \&load_handler );
28  
29 1;