More refactoring.
authorShlomi Fish <shlomif@shlomifish.org>
Sun, 11 Nov 2012 19:17:31 +0000 (21:17 +0200)
committerTony Cook <tony@develop-help.com>
Wed, 2 Jan 2013 00:21:59 +0000 (11:21 +1100)
lib/perl5db.pl

index 8bb69d2..cdf8826 100644 (file)
@@ -5645,38 +5645,32 @@ sub cmd_l {
     my $line = shift;
 
     # If this is '-something', delete any spaces after the dash.
-    $line =~ s/^-\s*$/-/;
+    $line =~ s/\A-\s*\z/-/;
 
     # If the line is '$something', assume this is a scalar containing a
     # line number.
     # Set up for DB::eval() - evaluate in *user* context.
     if ( my ($var_name) = $line =~ /\A(\$.*)/s ) {
         return _cmd_l_handle_var_name($var_name);
-    } ## end if ($line =~ /^(\$.*)/s)
-
+    }
     # l name. Try to find a sub by that name.
     elsif ( ($subname) = $line =~ /\A([\':A-Za-z_][\':\w]*(?:\[.*\])?)/s ) {
         return _cmd_l_handle_subname($cmd, $line);
-    } ## end elsif ($line =~ /^([\':A-Za-z_][\':\w]*(\[.*\])?)/s)
-
+    }
     # Bare 'l' command.
     elsif ( $line !~ /\S/ ) {
         return _cmd_l_empty();
     }
-
     # l [start]+number_of_lines
     elsif ( my ($new_start, $new_incr) = $line =~ /\A(\d*)\+(\d*)\z/ ) {
-
         return _cmd_l_plus($new_start, $new_incr);
-    } ## end elsif ($line =~ /^(\d*)\+(\d*)$/)
-
+    }
     # l start-stop or l start,stop
-    elsif ( my ($start_match, $end_match) =
-        $line =~ /^(?:(-?[\d\$\.]+)(?:[-,]([\d\$\.]+))?)?/ ) {
-
-        return _cmd_l_range($cmd, $line, $current_line, $start_match, $end_match);
+    elsif (my ($s, $e) = $line =~ /^(?:(-?[\d\$\.]+)(?:[-,]([\d\$\.]+))?)?/ ) {
+        return _cmd_l_range($cmd, $line, $current_line, $s, $e);
+    }
 
-    } ## end elsif ($line =~ /^((-?[\d\$\.]+)([-,]([\d\$\.]+))?)?/)
+    return;
 } ## end sub cmd_l
 
 =head3 C<cmd_L> - list breakpoints, actions, and watch expressions (command)