| 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, 2017-2026 -- leonerd@leonerd.org.uk | ||||||||||||||
| 5 | |||||||||||||||
| 6 | package Devel::MAT::Tool::Roots 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 List::Util qw( pairs ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 4 | ▶ | use constant CMD => "roots"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 18 | 4 | ▶ | use constant CMD_DESC => "Display a list of the root SVs"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 19 | |||||||||||||||
| 20 | =head1 NAME | ||||||||||||||
| 21 | |||||||||||||||
| 22 | C<Devel::MAT::Tool::Roots> - display a list of the root SVs | ||||||||||||||
| 23 | |||||||||||||||
| 24 | =head1 DESCRIPTION | ||||||||||||||
| 25 | |||||||||||||||
| 26 | This C<Devel::MAT> tool displays a list of all the root SVs. | ||||||||||||||
| 27 | |||||||||||||||
| 28 | =cut | ||||||||||||||
| 29 | |||||||||||||||
| 30 | =head1 COMMANDS | ||||||||||||||
| 31 | |||||||||||||||
| 32 | =for highlighter | ||||||||||||||
| 33 | |||||||||||||||
| 34 | =head2 roots | ||||||||||||||
| 35 | |||||||||||||||
| 36 | pmat> roots | ||||||||||||||
| 37 | the *@ GV : GLOB($*) at 0x1381ed0/errgv | ||||||||||||||
| 38 | the ARGV GV : GLOB(@*I) at 0x139f618/argvgv | ||||||||||||||
| 39 | ... | ||||||||||||||
| 40 | |||||||||||||||
| 41 | Prints a list of every root SV in the heap. | ||||||||||||||
| 42 | |||||||||||||||
| 43 | =cut | ||||||||||||||
| 44 | |||||||||||||||
| 45 | 0 | ▶ | sub run ( $self ) | ||||||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 46 | { | ||||||||||||||
| 47 | 0 | my $df = $self->df; | |||||||||||||
| 48 | |||||||||||||||
| 49 | Devel::MAT::Cmd->print_table( | ||||||||||||||
| 50 | [ map { | ||||||||||||||
| 51 | 0 | my ( $name, $description ) = @$_; | |||||||||||||
| 52 | 0 | my $addr = $df->root_at( $name ); | |||||||||||||
| 53 | 0 | my $sv = $df->sv_at( $addr ); | |||||||||||||
| 54 | |||||||||||||||
| 55 | 0 | ▶ | $sv ? [ "$description", Devel::MAT::Cmd->format_sv( $sv ) ] : | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 56 | $addr ? [ "$description", Devel::MAT::Cmd->format_value( $addr, addr => 1 ) ] : | ||||||||||||||
| 57 | () | ||||||||||||||
| 58 | } pairs $df->root_descriptions ], | ||||||||||||||
| 59 | sep => ": ", | ||||||||||||||
| 60 | ); | ||||||||||||||
| 61 | } | ||||||||||||||
| 62 | |||||||||||||||
| 63 | =head1 AUTHOR | ||||||||||||||
| 64 | |||||||||||||||
| 65 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||||
| 66 | |||||||||||||||
| 67 | =cut | ||||||||||||||
| 68 | |||||||||||||||
| 69 | 4 | 0x55AA; | |||||||||||||