blib/lib/Devel/DebugHooks/Terminal.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 48 CC 2 SCAR 12.0
CC
2
Cov
0%
get_command
6.0
BEGIN
2.0
import
2.0
CRAP 3.3
1 package Devel::DebugHooks::Terminal;
2  
3 our @ISA;
4  
5 BEGIN {
6 $DB::options{ trace_load } //= 0;
7 $DB::options{ trace_subs } //= 0;
8 $DB::options{ trace_returns } //= 0;
9 $DB::options{ dbg_frames } //= 0;
10 @DB::options{ qw/ w s / } = ( 1, 1 );
11 push @ISA, 'Devel::DebugHooks';
12 }
13  
14  
15  
16 sub import {
17 my $class = shift;
18  
19 $class->SUPER::import( @_ );
20 }
21  
22  
23  
24 sub bbreak {
25 my $self = shift;
26  
27 # print " -- $DB::file:$DB::line\n " .(DB::source()->[ $DB::line ] =~ s/^(\s+)//r); #/
28  
29 Devel::DebugHooks::Commands->process( 'l 0' );
30 }
31  
32  
33  
34 use Devel::DebugHooks();
35  
36  
37 # use Term::ReadLine;
38 my $term;
39 # BEGIN {
40 # $term = Term::ReadLine->new( 'Perl' );
41 # }
42 my $last_input;
43 sub get_command {
44 my $self = shift;
45  
46 # WORKAROUND: https://rt.cpan.org/Public/Bug/Display.html?id=110847
47 # print $DB::OUT "\n";
48 # print "DBG>";
49 my $line = <STDIN>; #$term->readline( 'DBG> ' );
50 chomp $line;
51 if( $line ne '' ) {
52 $last_input = $line;
53 }
54 else {
55 $line = $last_input;
56 }
57  
58 return $line;
59 }
60  
61  
62  
63 my $handler = DB::reg( 'interact', 'terminal' );
64 $$handler->{ context } = $DB::dbg;
65 $$handler->{ code } = \&Devel::DebugHooks::Commands::interact;
66  
67 #FIX: Decide where to complete subscribtion: from &import of from RT of module
68 $handler = DB::reg( 'bbreak', 'Terminal' );
69 $$handler->{ context } = $DB::dbg;
70 $$handler->{ code } = \&bbreak;
71  
72  
73 1;