From 0400fe7ed3738b95618fb6ae89d7191f894d03be Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 30 Sep 2012 14:17:09 +0200 Subject: [PATCH] [perl5db] Extract a function. --- lib/perl5db.pl | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 11515fd..6044fb5 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -4741,33 +4741,37 @@ sub _delete_all_breakpoints { return; } -sub delete_breakpoint { - my $i = shift; +sub _delete_breakpoint_from_line { + my ($i) = @_; - my $fn = $filename; + # Woops. This line wasn't breakable at all. + die "Line $i not breakable.\n" if $dbline[$i] == 0; - # If we got a line, delete just that one. - if ( defined($i) ) { + # Kill the condition, but leave any action. + $dbline{$i} =~ s/\A[^\0]*//; - # Woops. This line wasn't breakable at all. - die "Line $i not breakable.\n" if $dbline[$i] == 0; + # Remove the entry entirely if there's no action left. + if ($dbline{$i} eq '') { + _remove_breakpoint_entry($filename, $i); + } - # Kill the condition, but leave any action. - $dbline{$i} =~ s/\A[^\0]*//; + return; +} - # Remove the entry entirely if there's no action left. - if ($dbline{$i} eq '') { - _remove_breakpoint_entry($fn, $i); - } - } +sub delete_breakpoint { + my $i = shift; + # If we got a line, delete just that one. + if ( defined($i) ) { + _delete_breakpoint_from_line($i); + } # No line; delete them all. else { _delete_all_breakpoints(); - } ## end else [ if (defined($i)) + } return; -} ## end sub delete_breakpoint +} =head3 cmd_stop (command) -- 2.7.4