BCSSH/Help.pm

filter: Statementstmt 27.7% 10 / 36 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 22.2% 12 / 54 CC 8 SCAR 40.6
CC
8
Cov
20%
__ANON__
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 57.8
« BCSSH/Command/ssh.pm ↑ Summary BCSSH/Proxy.pm »
1 package App::BCSSH::Help;
2 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use App::BCSSH::Util qw(command_to_package package_to_command);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 has opt_help => (is => 'ro', arg_spec => 'help');
6 1 has opt_help_short => (is => 'ro', arg_spec => 'h');
7  
8 0 ▶around run => sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
9 0 my $orig = shift;
10 0 my $self = shift;
11 0 ▶ if ($self->opt_help_short) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->opt_help_short) { } 0 0 0
elsif ($self->opt_help) { } 0 0 0
12 0 my $package = ref $self;
13 0 require App::BCSSH;
14 0 require App::BCSSH::Pod;
15 0 my $parsed = App::BCSSH::Pod->parse($package);
16 0 my ($abstract, $synopsis, $options) = @{$parsed}{qw(abstract synopsis options)};
17 0 my $command = package_to_command($package);
18 0 printf "bcssh %0.6f\n", $App::BCSSH::VERSION;
19 0 print "bcssh $command";
20 0 ▶ print " - $abstract"
Branch: 1 branch
BranchTrueFalseTotal
if $abstract 0 0 0
21 if $abstract;
22 0 print "\n";
23 0 ▶ print "\nSynopsis:\n$synopsis\n"
Branch: 1 branch
BranchTrueFalseTotal
if $synopsis 0 0 0
24 if $synopsis;
25  
26 0 ▶ if ($options && %$options) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options and %$options) 0 0 0
Condition0%0/3
$options and %$options
!ll&&!rl&&r
000
MC/DC0%0/2
$options and %$options
$options %$options
Truth table0%0/3
A and B
A= $optionsB= %$options
ABresult
0X0
100
111
27 0 print "\nOptions:\n";
28 0 for my $option (sort keys %$options) {
29 0 my $short = $options->{$option};
30 0 $short =~ s/\..*/./;
31 0 printf "%15s : %s\n", $option, $short;
32 }
33 }
34 0 return 1;
35 }
36 elsif ($self->opt_help) {
37 0 my $package = ref $self;
38 0 require App::BCSSH::Command::help;
39 0 return App::BCSSH::Command::help->new->help_for_package($package);
40 }
41 0 return $self->$orig(@_);
42 1 };
43  
44 1 1;
45 __END__
« BCSSH/Command/ssh.pm ↑ Summary BCSSH/Proxy.pm »