summaryrefslogtreecommitdiff
path: root/lib/perl5db.pl
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2012-10-08 15:32:24 +0200
committerRicardo Signes <rjbs@cpan.org>2012-11-12 09:18:38 -0500
commit553947ba6b26bdcfbae00f5b3bdfc7fff840a160 (patch)
tree6230dee53be13e48a0db5acde94068d641201ee9 /lib/perl5db.pl
parent4f29ef90364577a311f8270f206a8386ae25e379 (diff)
downloadperl-553947ba6b26bdcfbae00f5b3bdfc7fff840a160.tar.gz
Extract a common method.
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r--lib/perl5db.pl23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 72461eb0ba..9bf7bc8bb8 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -3906,27 +3906,28 @@ sub _handle_save_command {
return;
}
-sub _handle_s_and_arg_command {
- my $self = shift;
+sub _handle_n_or_s_and_arg_command {
+ my ($self, $letter, $new_val) = @_;
# s - single-step. Remember the last command was 's'.
- if ($DB::cmd =~ s#\As\s#\$DB::single = 1;\n#) {
- $laststep = 's';
+ if ($DB::cmd =~ s#\A\Q$letter\E\s#\$DB::single = $new_val;\n#) {
+ $laststep = $letter;
}
return;
}
-sub _handle_n_and_arg_command {
+
+sub _handle_s_and_arg_command {
my $self = shift;
- # n - single-step, but not into subs. Remember last command
- # was 'n'.
- if ($DB::cmd =~ s#\An\s#\$DB::single = 2;\n#) {
- $laststep = 'n';
- }
+ return $self->_handle_n_or_s_and_arg_command('s', 1);
+}
- return;
+sub _handle_n_and_arg_command {
+ my $self = shift;
+
+ return $self->_handle_n_or_s_and_arg_command('n', 2);
}
package DB;