-
Notifications
You must be signed in to change notification settings - Fork 8
/
Undisplay.pm
64 lines (55 loc) · 1.83 KB
/
Undisplay.pm
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
59
60
61
62
63
64
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Rocky Bernstein <rocky@cpan.org>
use warnings; no warnings 'redefine';
use lib '../../../..';
package Devel::Trepan::CmdProcessor::Command::Undisplay;
use English qw( -no_match_vars );
use if !defined @ISA, Devel::Trepan::CmdProcessor::Command ;
unless (defined @ISA) {
eval "use constant CATEGORY => 'data';";
eval "use constant NEED_STACK => 0;";
eval "use constant SHORT_HELP => 'Cancel some expressions to be displayed when program stops';"
}
use strict; use vars qw(@ISA); @ISA = @CMD_ISA;
use vars @CMD_VARS; # Value inherited from parent
our $MIN_ARGS = 0; # Need at least this many
our $MAX_ARGS = undef; # Need at most this many - undef -> unlimited.
our $NAME = set_name();
our $HELP = <<"HELP";
${NAME} DISPLAY_NUMBER ...
Cancel some expressions to be displayed when program stops. Arguments
are the code numbers of the expressions to stop displaying. No
argument means cancel all automatic-display expressions. "delete
display" has the same effect as this command. Used "info display" to
see current list of display numbers.
HELP
# This method runs the command
sub run($$) {
my ($self, $args) = @_;
my $proc = $self->{proc};
my @args = @$args;
if (scalar @args == 1) {
if ($proc->confirm('Delete all displays?', 0)) {
$proc->{displays}->reset;
return;
}
}
shift @args;
for my $num_str (@args) {
my $opts = {msg_on_error => sprintf('%s must be a display number', $num_str)};
my $i = $proc->get_an_int($num_str);
if ($i) {
unless($proc->{displays}->delete($i)) {
$proc->errmsg("No display number $i");
return;
}
}
}
}
unless (caller) {
require Devel::Trepan::CmdProcessor::Mock;
my $proc = Devel::Trepan::CmdProcessor::Mock::setup();
# my $cmd = __PACKAGE__->new($proc);
# $cmd->run([$NAME]);
}
1;