| line | stmt | bran | cond | sub | pod | time | code | 
| 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 -- leonerd@leonerd.org.uk | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | package Devel::MAT::Tool::Stack 0.51; | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 5 |  |  | 5 |  | 3409 | use v5.14; | 
|  | 5 |  |  |  |  | 27 |  | 
| 9 | 5 |  |  | 5 |  | 27 | use warnings; | 
|  | 5 |  |  |  |  | 9 |  | 
|  | 5 |  |  |  |  | 146 |  | 
| 10 | 5 |  |  | 5 |  | 28 | use base qw( Devel::MAT::Tool ); | 
|  | 5 |  |  |  |  | 12 |  | 
|  | 5 |  |  |  |  | 490 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 5 |  |  | 5 |  | 34 | use constant CMD => "stack"; | 
|  | 5 |  |  |  |  | 11 |  | 
|  | 5 |  |  |  |  | 269 |  | 
| 13 | 5 |  |  | 5 |  | 37 | use constant CMD_DESC => "Display the value stack"; | 
|  | 5 |  |  |  |  | 19 |  | 
|  | 5 |  |  |  |  | 814 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 NAME | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | C - display the value stack | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | This C tool displays the captured state of the value stack, | 
| 22 |  |  |  |  |  |  | showing the SVs in place there. | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =cut | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | =head1 COMMANDS | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head2 stack | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | pmat> stack | 
| 31 |  |  |  |  |  |  | [1]: SCALAR(PV) at 0x55cde0fa0830 = "tiny.pmat" | 
| 32 |  |  |  |  |  |  | [0]: UNDEF at 0x55cde0f71398 | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | Prints SVs on the value stack. | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | =cut | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub run | 
| 39 |  |  |  |  |  |  | { | 
| 40 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 0 |  |  |  |  |  | my @stacksvs = $self->df->stack; | 
| 43 | 0 |  |  |  |  |  | foreach my $idx ( reverse 0 .. $#stacksvs ) { | 
| 44 | 0 |  |  |  |  |  | my $sv = $stacksvs[$idx]; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 |  |  |  |  |  | Devel::MAT::Cmd->printf( "[%d]: %s\n", | 
| 47 |  |  |  |  |  |  | $idx, Devel::MAT::Cmd->format_sv_with_value( $sv ) | 
| 48 |  |  |  |  |  |  | ); | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | 0x55AA; |