Psh/Strategy/Debug.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 44 CC 2 SCAR 10.6
CC
2
Cov
0%
applies
6.0
new
2.0
consumes
2.0
CRAP 2.9
1 package Psh::Strategy::Debug;
2  
3 =item * C<debug>
4  
5 Entering "? commandline" will show information about the
6 way Perl Shell processes the input
7  
8 This has to be beautified a lot and should not use Data::Dumper.
9  
10 =cut
11  
12 require Psh::Strategy;
13 require Psh::Support::Debug;
14  
15 @Psh::Strategy::Debug::ISA=('Psh::Strategy');
16  
17 sub new { Psh::Strategy::new(@_) }
18  
19 sub consumes {
20 return Psh::Strategy::CONSUME_LINE;
21 }
22  
23 sub runs_before {
24 return qw(executable auto_cd built_in);
25 }
26  
27 sub applies {
28 my $fnname= ${$_[1]};
29  
30 if ($fnname=~/^\?/) {
31 return "debug $fnname";
32 }
33 return '';
34 }
35  
36 sub execute {
37 my $fnname= ${$_[1]};
38 my @tmp= Psh::Parser::make_tokens(substr($fnname,1),1);
39 use Data::Dumper;
40 print "Wordsplit:\n";
41 print Dumper(\@tmp);
42 @tmp= Psh::Parser::make_tokens(substr($fnname,1));
43 print "Tokenization:\n";
44 print Psh::Support::Debug::explain_tokens(\@tmp)."\n";
45 @tmp= Psh::Parser::parse_line(substr($fnname,1));
46 print Dumper(\@tmp);
47 return (1,undef);
48 }
49  
50 1;