summaryrefslogtreecommitdiff
path: root/lib/perl5db.pl
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2012-11-14 13:38:37 +0200
committerTony Cook <tony@develop-help.com>2013-01-02 11:22:03 +1100
commitdb66d27d1fc06a2481f86ac632dc733a286b6d18 (patch)
treef4dc26c1a7537d6de9ba9bbe7faa756a33a4aecb /lib/perl5db.pl
parentd0bfb56c17bf64c9c527608ddc40b8b24d944b39 (diff)
downloadperl-db66d27d1fc06a2481f86ac632dc733a286b6d18.tar.gz
Extract a subroutine.
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r--lib/perl5db.pl80
1 files changed, 44 insertions, 36 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 9574084c92..330f7a9aeb 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -5729,6 +5729,49 @@ sub _cmd_L_calc_wanted_flags {
return (map { index($arg, $_) >= 0 ? 1 : 0 } qw(a b w));
}
+
+sub _cmd_L_handle_breakpoints {
+ my ($handle_db_line) = @_;
+
+ BREAKPOINTS_SCAN:
+ # Look in all the files with breakpoints...
+ for my $file ( keys %had_breakpoints ) {
+
+ # Temporary switch to this file.
+ local *dbline = $main::{ '_<' . $file };
+
+ # Set up to look through the whole file.
+ $max = $#dbline;
+ my $was; # Flag: did we print something
+ # in this file?
+
+ # For each line in the file ...
+ for my $i (1 .. $max) {
+
+ # We've got something on this line.
+ if ( defined $dbline{$i} ) {
+
+ # Print the header if we haven't.
+ if (not $was++) {
+ print {$OUT} "$file:\n";
+ }
+
+ # Print the line.
+ print {$OUT} " $i:\t", $dbline[$i];
+
+ $handle_db_line->($dbline{$i});
+
+ # Quit if the user hit interrupt.
+ if ($signal) {
+ last BREAKPOINTS_SCAN;
+ }
+ } ## end if (defined $dbline{$i...
+ } ## end for my $i (1 .. $max)
+ } ## end for my $file (keys %had_breakpoints)
+
+ return;
+}
+
sub cmd_L {
my $cmd = shift;
@@ -5754,42 +5797,7 @@ sub cmd_L {
# Breaks and actions are found together, so we look in the same place
# for both.
if ( $break_wanted or $action_wanted ) {
-
- BREAKPOINTS_SCAN:
- # Look in all the files with breakpoints...
- for my $file ( keys %had_breakpoints ) {
-
- # Temporary switch to this file.
- local *dbline = $main::{ '_<' . $file };
-
- # Set up to look through the whole file.
- $max = $#dbline;
- my $was; # Flag: did we print something
- # in this file?
-
- # For each line in the file ...
- for my $i (1 .. $max) {
-
- # We've got something on this line.
- if ( defined $dbline{$i} ) {
-
- # Print the header if we haven't.
- if (not $was++) {
- print {$OUT} "$file:\n";
- }
-
- # Print the line.
- print {$OUT} " $i:\t", $dbline[$i];
-
- $handle_db_line->($dbline{$i});
-
- # Quit if the user hit interrupt.
- if ($signal) {
- last BREAKPOINTS_SCAN;
- }
- } ## end if (defined $dbline{$i...
- } ## end for my $i (1 .. $max)
- } ## end for my $file (keys %had_breakpoints)
+ _cmd_L_handle_breakpoints($handle_db_line);
} ## end if ($break_wanted or $action_wanted)
# Look for breaks in not-yet-compiled subs: