File: Stack.pm

package info (click to toggle)
libdevel-mat-perl 0.53-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 908 kB
  • sloc: perl: 6,224; makefile: 3
file content (58 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#  You may distribute under the terms of either the GNU General Public License
#  or the Artistic License (the same terms as Perl itself)
#
#  (C) Paul Evans, 2019-2024 -- leonerd@leonerd.org.uk

package Devel::MAT::Tool::Stack 0.53;

use v5.14;
use warnings;
use base qw( Devel::MAT::Tool );

use constant CMD => "stack";
use constant CMD_DESC => "Display the value stack";

=head1 NAME

C<Devel::MAT::Tool::Stack> - display the value stack

=head1 DESCRIPTION

This C<Devel::MAT> tool displays the captured state of the value stack,
showing the SVs in place there.

=cut

=head1 COMMANDS

=head2 stack

   pmat> stack
   [1]: SCALAR(PV) at 0x55cde0fa0830 = "tiny.pmat"
   [0]: UNDEF at 0x55cde0f71398

Prints SVs on the value stack.

=cut

sub run
{
   my $self = shift;

   my @stacksvs = $self->df->stack;
   foreach my $idx ( reverse 0 .. $#stacksvs ) {
      my $sv = $stacksvs[$idx];

      Devel::MAT::Cmd->printf( "[%d]: %s\n",
         $idx, Devel::MAT::Cmd->format_sv_with_value( $sv )
      );
   }
}

=head1 AUTHOR

Paul Evans <leonerd@leonerd.org.uk>

=cut

0x55AA;