| 1 | package App::BCSSH::Command::commands; | ||||||||||||
| 2 | 1 | ▶ | use strictures 1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | 1 | ▶ | use App::BCSSH::Util qw(find_mods package_to_command); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use App::BCSSH::Pod; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 0 | ▶ | sub new { bless {}, $_[0] } | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 8 | |||||||||||||
| 9 | 0 | ▶ | sub run { | ||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 10 | 0 | my $self = shift; | |||||||||||
| 11 | 0 | print $self->commands_message; | |||||||||||
| 12 | } | ||||||||||||
| 13 | |||||||||||||
| 14 | 0 | ▶ | sub commands_message { | ||||||||||
|
Subroutine
commands_message: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 15 | 0 | my $self = shift; | |||||||||||
| 16 | 0 | my $commands = $self->get_commands; | |||||||||||
| 17 | 0 | my $msg = "Available commands:\n"; | |||||||||||
| 18 | 0 | for my $command (sort keys %$commands) { | |||||||||||
| 19 | 0 | ▶ | $msg .= sprintf "\t%-15s %s\n", $command, ($commands->{$command}||''); | ||||||||||
|
Condition0%0/2
$commands->{$command} || ''
MC/DC0%0/1
$commands->{$command} || ''
$commands->{$command}
Truth table0%0/2
A
A= $commands->{$command}
| |||||||||||||
| 20 | } | ||||||||||||
| 21 | 0 | return $msg; | |||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 0 | ▶ | sub get_commands { | ||||||||||
|
Subroutine
get_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 25 | 0 | my $command_ns = 'App::BCSSH::Command'; | |||||||||||
| 26 | 0 | my @mods = find_mods($command_ns); | |||||||||||
| 27 | return { map { | ||||||||||||
| 28 | 0 | my $package = $_; | |||||||||||
| 29 | 0 | my $abstract = App::BCSSH::Pod->parse($package)->{abstract}; | |||||||||||
| 30 | 0 | my $command = package_to_command($package); | |||||||||||
| 31 | 0 | ( $command, $abstract ) | |||||||||||
| 32 | } @mods }; | ||||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 1 | 1; | |||||||||||
| 36 | |||||||||||||
| 37 | __END__ | ||||||||||||