| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||||||||||||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # (C) Paul Evans, 2022-2026 -- leonerd@leonerd.org.uk | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package Devel::MAT::Tool::Tools 0.56; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use v5.20; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use base qw( Devel::MAT::Tool ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use feature qw( postderef signatures ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 4 | ▶ | no warnings qw( experimental::postderef experimental::signatures ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use constant CMD => "tools"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use constant CMD_DESC => "List the available tools"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 NAME | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | C<Devel::MAT::Tool::Tools> - display a list of the available tools | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | This C<Devel::MAT> tool displays a list of the names and descriptions of | ||||||||||||||||||||||||||||
| 25 | additional tools that may be available, and allows loading them. | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =cut | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 COMMANDS | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =for highlighter | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head2 tools | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | pmat> tools | ||||||||||||||||||||||||||||
| 36 | Reachability - <no desc> | ||||||||||||||||||||||||||||
| 37 | Sizes - <no desc> | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Prints a list of the names of every additional tool that is available to load | ||||||||||||||||||||||||||||
| 40 | into the F<pmat> analysis shell. Each is prefixed with a C<*> if it is already | ||||||||||||||||||||||||||||
| 41 | loaded. | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | Currently, only the tools marked C<FOR_UI> are actually listed, which isn't | ||||||||||||||||||||||||||||
| 44 | helpful in the shell as many tools are useful without UI additions. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =cut | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub run ( $self ) | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||
| 50 | 0 | my @table; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | foreach my $tool ( sort Devel::MAT->available_tools ) { | |||||||||||||||||||||||||||
| 53 | 0 | my $tool_class = "Devel::MAT::Tool::$tool"; | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | next unless $tool_class->can( "FOR_UI" ) and $tool_class->FOR_UI; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tool_class->can("FOR_UI") and $tool_class->FOR_UI
MC/DC0%0/2
$tool_class->can("FOR_UI") and $tool_class->FOR_UI
$tool_class->can("FOR_UI")
$tool_class->FOR_UI
Truth table0%0/3
A and B
A= $tool_class->can("FOR_UI")B= $tool_class->FOR_UI
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $desc = $tool_class->can( "TOOL_DESC" ) ? $tool_class->TOOL_DESC : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $loaded = $self->pmat->has_tool( $tool ); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | push @table, [ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$desc // "<no desc>"
MC/DC0%0/1
$desc // "<no desc>"
$desc
Truth table0%0/2
A
A= $desc
| |||||||||||||||||||||||||||||
| 61 | String::Tagged->from_sprintf( "%s %s", | ||||||||||||||||||||||||||||
| 62 | ( $loaded ? Devel::MAT::Cmd->format_note( "*", 1 ) : " " ), | ||||||||||||||||||||||||||||
| 63 | Devel::MAT::Cmd->format_note( $tool, 0 ), | ||||||||||||||||||||||||||||
| 64 | ), | ||||||||||||||||||||||||||||
| 65 | $desc // "<no desc>" | ||||||||||||||||||||||||||||
| 66 | ]; | ||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | Devel::MAT::Cmd->print_table( \@table, sep => " - " ); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | package # hide | ||||||||||||||||||||||||||||
| 73 | Devel::MAT::Tool::Tools::_tool; | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 4 | ▶ | use base qw( Devel::MAT::Tool ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 4 | ▶ | use constant CMD => "tool"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 78 | 4 | ▶ | use constant CMD_DESC => "Load an extension tool"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 4 | ▶ | use constant CMD_ARGS => ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | { name => "tool", help => "the name of the tool to load" }, | ||||||||||||||||||||||||||||
| 82 | 4 | ); | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =head2 tool | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | Loads an additional analysis tool. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | pmat> tool Sizes | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub run ( $self, $toolname ) | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | 0 | my $tool = $self->pmat->load_tool( $toolname, progress => $self->{progress} ); | |||||||||||||||||||||||||||
| 95 | 0 | $self->report_progress(); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =cut | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 4 | 0x55AA; | |||||||||||||||||||||||||||