| 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, 2019-2026 -- leonerd@leonerd.org.uk | ||
| 5 | |||
| 6 | package Devel::MAT::Tool::Stack 0.56; | ||
| 7 | |||
| 8 | 5 | ▶ | use v5.20; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 5 | ▶ | use base qw( Devel::MAT::Tool ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 5 | ▶ | use feature qw( postderef signatures ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 5 | ▶ | no warnings qw( experimental::postderef experimental::signatures ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 5 | ▶ | use constant CMD => "stack"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 5 | ▶ | use constant CMD_DESC => "Display the value stack"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | C<Devel::MAT::Tool::Stack> - display the value stack | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This C<Devel::MAT> tool displays the captured state of the value stack, | ||
| 25 | showing the SVs in place there. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | =head1 COMMANDS | ||
| 30 | |||
| 31 | =for highlighter | ||
| 32 | |||
| 33 | =head2 stack | ||
| 34 | |||
| 35 | pmat> stack | ||
| 36 | [1]: SCALAR(PV) at 0x55cde0fa0830 = "tiny.pmat" | ||
| 37 | [0]: UNDEF at 0x55cde0f71398 | ||
| 38 | |||
| 39 | Prints SVs on the value stack. | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | 0 | ▶ | sub run ( $self ) |
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||
| 44 | { | ||
| 45 | 0 | my @stacksvs = $self->df->stack; | |
| 46 | 0 | foreach my $idx ( reverse 0 .. $#stacksvs ) { | |
| 47 | 0 | my $sv = $stacksvs[$idx]; | |
| 48 | |||
| 49 | 0 | Devel::MAT::Cmd->printf( "[%d]: %s\n", | |
| 50 | $idx, Devel::MAT::Cmd->format_sv_with_value( $sv ) | ||
| 51 | ); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | =head1 AUTHOR | ||
| 56 | |||
| 57 | Paul Evans <leonerd@leonerd.org.uk> | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | 5 | 0x55AA; | |