« blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Highlight.pm
↑ Summary
blib/lib/Devel/Trepan/Pod2Text.pm »
| 1 | # -*- coding: utf-8 -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Copyright (C) 2011-2012, 2014-2016 Rocky Bernstein <rocky@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Interface when communicating with the user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 52 | ▶ | use warnings; no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 52 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 52 | ▶ | use rlib '../../..'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | package Devel::Trepan::Interface::User; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 52 | ▶ | use vars qw(@EXPORT @ISA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 52 | ▶ | use if !@ISA, Devel::Trepan::Util; # qw(hash_merge YN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 52 | ▶ | use if !@ISA, Devel::Trepan::IO::Input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 52 | ▶ | use if !@ISA, Devel::Trepan::Interface; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 52 | @ISA = qw(Devel::Trepan::Interface Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 52 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # Interface when communicating with the user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 52 | ▶ | use constant DEFAULT_USER_OPTS => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | readline => # Try to use Term::ReadLine? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | $Devel::Trepan::IO::Input::HAVE_TERM_READLINE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # The below are only used if we want and have readline support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # See method Trepan::term_readline below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | histsize => 256, # Use gdb's default setting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | file_history => '.trepanpl_hist', # where history file lives | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # Note a directory will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # be appended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | history_save => 1 # do we save the history? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 52 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my($class, $inp, $out, $opts) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $opts = hash_merge($opts, DEFAULT_USER_OPTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $self = Devel::Trepan::Interface->new($inp, $out, $opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->{opts} = $opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ($inp && $inp->isa('Devel::Trepan::IO:InputBase')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$inp and $inp->isa("Devel::Trepan::IO:InputBase")
$inp and $inp->isa("Devel::Trepan::IO:InputBase")
MC/DC0%0/2
$inp and $inp->isa("Devel::Trepan::IO:InputBase")
$inp
$inp->isa("Devel::Trepan::IO:InputBase")
MC/DC0%0/2
$inp and $inp->isa("Devel::Trepan::IO:InputBase")
$inp
$inp->isa("Devel::Trepan::IO:InputBase")
Truth table66%2/3
A and B
A= $inpB= $inp->isa("Devel::Trepan::IO:InputBase")
Truth table0%0/3
A and B
A= $inpB= $inp->isa("Devel::Trepan::IO:InputBase")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $self->{input} = $inp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | $self->{input} = Devel::Trepan::IO::Input->new($inp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | {readline => $opts->{readline}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($self->{input}{term_readline}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($self->{opts}{complete}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $attribs = $inp->{readline}->Attribs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $attribs->{attempted_completion_function} = $self->{opts}{complete}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $self->read_history(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | sub add_history($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_history: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | my ($self, $command) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_history: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | return unless (($self->{input}{readline}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | and $self->{input}{readline}->can('add_history')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$self->{"input"}{"readline"} and $self->{"input"}{"readline"}->can("add_history")
$self->{"input"}{"readline"} and $self->{"input"}{"readline"}->can("add_history")
MC/DC0%0/2
$self->{"input"}{"readline"} and $self->{"input"}{"readline"}->can("add_history")
$self->{"input"}{"readline"}
$self->{"input"}{"readline"}->can("add_history")
MC/DC0%0/2
$self->{"input"}{"readline"} and $self->{"input"}{"readline"}->can("add_history")
$self->{"input"}{"readline"}
$self->{"input"}{"readline"}->can("add_history")
Truth table0%0/3
A and B
A= $self->{"input"}{"readline"}B= $self->{"input"}{"readline"}->can("add_history")
Truth table0%0/3
A and B
A= $self->{"input"}{"readline"}B= $self->{"input"}{"readline"}->can("add_history")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $self->{input}{readline}->add_history($command) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ($self->can('add_history_time')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $now = localtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->{input}{readline}->add_history_time($now); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Having problems with setting destroy to write history. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # So write it after each add. Ugh. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # Use Term::ReadLine::Gnu name WriteHistory, since Gnu doesn't have | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # write_history(). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $self->{input}{readline}->WriteHistory($self->{histfile}, $command) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | if $self->can('WriteHistory'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | sub remove_history($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_history: called CC=6 SCAR=30.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my ($self, $which) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_history: not called CC=6 SCAR=30.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $which = -1 unless defined($which); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless ($self->{input}{readline}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ($self->{input}{readline}->can("where_history")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $where_history = $self->{input}{readline}->where_history(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $which = $where_history unless defined $which; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | $self->{input}{readline}->remove_history($which) if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $self->{input}{readline}->can("remove_history"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | sub is_closed($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_closed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_closed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $self->{input}->is_eof && $self->{output}->is_eof; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # Called when a dangerous action is about to be done, to make | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # sure it's okay. Expect a yes/no answer to `prompt' which is printed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # suffixed with a question mark and the default value. The user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # response converted to a boolean is returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # FIXME: make common routine for this and server.rb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 10 | ▶ | sub confirm($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
confirm: called CC=5 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | my($self, $prompt, $default) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
confirm: not called CC=5 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | my $default_str = $default ? 'Y/n' : 'N/y'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $response = $self->readline(sprintf '%s (%s) ', $prompt, $default_str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | return $default if $self->{input}->is_eof; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | chomp($response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | return $default if $response eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ($response = lc(unpack("A*", $response))) =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # We don't catch "Yes, I'm sure" or "NO!", but I leave that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # as an exercise for the reader. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | last if grep(/^${response}$/, @Devel::Trepan::Util::YN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->msg( "Please answer 'yes' or 'no'. Try again."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $self->remove_history; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | return grep(/^${response}$/, YES); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 52 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # Read a saved Readline history file into Readline. The history | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # file will be created if it doesn't already exist. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # Much of this code follows what's done in ruby-debug. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub read_history($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_history: called CC=9 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_history: not called CC=9 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my %opts = %{$self->{opts}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | unless ($self->{histfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my $dirname = $ENV{'HOME'} || $ENV{'HOMEPATH'} || glob('~'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%2/12
$ENV{'HOME'} || $ENV{'HOMEPATH'} || glob('~')
$ENV{"HOME"} or $ENV{"HOMEPATH"}
$ENV{'HOME'} || $ENV{'HOMEPATH'} || glob('~')
$ENV{"HOME"} or $ENV{"HOMEPATH"}
MC/DC0%0/3
$ENV{'HOME'} || $ENV{'HOMEPATH'} || glob('~')
$ENV{"HOME"}
$ENV{"HOMEPATH"}
glob('~')
MC/DC0%0/3
$ENV{'HOME'} || $ENV{'HOMEPATH'} || glob('~')
$ENV{"HOME"}
$ENV{"HOMEPATH"}
glob('~')
Truth table25%1/4
A or B || C
A= $ENV{"HOME"}B= $ENV{"HOMEPATH"}C= glob('~')
Truth table0%0/4
A or B || C
A= $ENV{"HOME"}B= $ENV{"HOMEPATH"}C= glob('~')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->{histfile} = File::Spec->catfile($dirname, $opts{file_history}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | my $histsize = $ENV{'HISTSIZE'} ? $ENV{'HISTSIZE'} : $opts{histsize}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $self->{histsize} = $histsize unless defined $self->{histsize}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if ( -f $self->{histfile} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $self->{input}{readline}->StifleHistory($self->{histsize}) if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $self->{input}{readline}->can("StifleHistory"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | $self->{input}{readline}->ReadHistory($self->{histfile}) if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $self->{input}{readline}->can("ReadHistory"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | sub is_interactive($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_interactive: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_interactive: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $self->{input}->is_interactive; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | sub rl_filename_list($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rl_filename_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | my ($self,$prefix) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rl_filename_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self->{input}->rl_filename_list($prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | sub has_completion($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_completion: called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_completion: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $self->{input}{term_readline}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | sub want_term_readline($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
want_term_readline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
want_term_readline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | defined($self->{opts}{readline}) && $self->{input}{term_readline}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # read a debugger command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub read_command($;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_command: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my($self, $prompt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_command: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $prompt = '(trepanpl) ' unless defined $prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $last = $self->readline($prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my $line = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $prompt .= '>> '; # continuation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | $last ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$last ||= ""
$last ||= ""
MC/DC0%0/1
$last ||= ""
$last
MC/DC0%0/1
$last ||= ""
$last
Truth table0%0/2
A
A= $last
Truth table0%0/2
A
A= $last
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | while ($last && '\\' eq substr($last, -1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$last and "\\" eq substr($last, -1)
$last and "\\" eq substr($last, -1)
MC/DC0%0/2
$last and "\\" eq substr($last, -1)
$last
"\\" eq substr($last, -1)
MC/DC0%0/2
$last and "\\" eq substr($last, -1)
$last
"\\" eq substr($last, -1)
Truth table0%0/3
A and B
A= $lastB= "\\" eq substr($last, -1)
Truth table0%0/3
A and B
A= $lastB= "\\" eq substr($last, -1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $line .= substr($last, 0, -1) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $last = $self->readline($prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | $line .= $last if defined $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub readline($;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readline: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | my($self, $prompt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readline: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{output}->flush; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if ($self->want_term_readline) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->{input}->readline($prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $self->{output}->write($prompt) if defined($prompt) && $prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
defined $prompt and $prompt
defined $prompt and $prompt
MC/DC0%0/2
defined $prompt and $prompt
defined $prompt
$prompt
MC/DC0%0/2
defined $prompt and $prompt
defined $prompt
$prompt
Truth table0%0/3
A and B
A= defined $promptB= $prompt
Truth table0%0/3
A and B
A= defined $promptB= $prompt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->{input}->readline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | sub set_completion($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_completion: called CC=2 SCAR=8.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | my ($self, $completion_fn, $list_completion_fn) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_completion: not called CC=2 SCAR=8.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | return unless $self->has_completion; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $attribs = $self->{input}{readline}->Attribs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # Silence "used only once warnings" inside ReadLine::Term::Perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 52 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $readline::rl_completion_entry_function = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $readline::rl_attempted_completion_function = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $attribs->{completion_entry_function} = $list_completion_fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # For Term:ReadLine::Gnu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $attribs->{attempted_completion_function} = $completion_fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # For Term::ReadLine::Perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $readline::rl_completion_function = $completion_fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $attribs->{completion_function} = $completion_fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # Demo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 52 | ▶ | unless (caller) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $intf = Devel::Trepan::Interface::User->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $intf->msg("Hi, there!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $intf->errmsg("Houston, we have a problem here!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $intf->errmsg(['Two', 'lines']); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | printf "Is interactive: %s\n", ($intf->is_interactive ? "yes" : "no"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | printf "Has completion: %s\n", ($intf->has_completion ? "yes" : "no"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $save_term_readline = $HAVE_TERM_READLINE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | foreach my $term (qw(Gnu Perl5)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $HAVE_TERM_READLINE = $term; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $path='./'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my @files = $intf->rl_filename_list($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | printf "term: %s, path: %s\n", $term, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | foreach my $file (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | print "\t$file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $HAVE_TERM_READLINE = $save_term_readline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if (scalar(@ARGV) > 0 && $intf->is_interactive) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @ARGV > 0 and $intf->is_interactive
MC/DC0%0/2
scalar @ARGV > 0 and $intf->is_interactive
scalar @ARGV > 0
$intf->is_interactive
Truth table0%0/3
A and B
A= scalar @ARGV > 0B= $intf->is_interactive
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $line = $intf->readline("Type something: "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ($intf->is_input_eof) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $intf->msg("No input, got EOF\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $intf->msg("You typed: $line"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $intf->msg(sprintf "input EOF is now: %d", $intf->{input}->is_eof); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | unless ($intf->{input}->is_eof) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $intf->msg("Now we in read a command"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $line = $intf->read_command("Type a command something: "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if ($intf->is_input_eof) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $intf->msg("No input, got EOF"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $intf->msg("You typed: $line"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | unless ($intf->is_input_eof) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $line = $intf->confirm("Are you sure", 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | chomp($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $intf->msg("you typed: ${line}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $intf->msg(sprintf "eof is now: %d", $intf->{input}->is_eof); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $line = $intf->confirm("Really sure", 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $intf->msg("you typed: $line"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $intf->msg(sprintf "eof is now: %d", $intf->{input}->is_eof); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | printf "User interface closed?: %d\n", $intf->is_closed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $intf->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # Note STDOUT is closed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | printf STDERR "User interface closed?: %d\n", $intf->is_closed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 52 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||