This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl5db] Extract another function.
authorShlomi Fish <shlomif@shlomifish.org>
Thu, 4 Oct 2012 16:41:13 +0000 (18:41 +0200)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:34 +0000 (09:18 -0500)
lib/perl5db.pl

index 2e65982..40f5750 100644 (file)
@@ -1888,6 +1888,27 @@ sub _DB__handle_f_command {
     return;
 }
 
+sub _DB__handle_dot_command {
+    my ($obj) = @_;
+
+    # . command.
+    if ($cmd eq '.') {
+        $incr = -1;    # stay at current line
+
+        # Reset everything to the old location.
+        $start    = $line;
+        $filename = $filename_ini;
+        *dbline   = $main::{ '_<' . $filename };
+        $max      = $#dbline;
+
+        # Now where are we?
+        print_lineinfo($obj->position());
+        next CMD;
+    }
+
+    return;
+}
+
 sub DB {
 
     # lock the debugger and get the thread id for the prompt
@@ -2282,20 +2303,7 @@ and then we look up the line in the magical C<%dbline> hash.
 
 =cut
 
-                # . command.
-                if ($cmd eq '.') {
-                    $incr = -1;    # stay at current line
-
-                    # Reset everything to the old location.
-                    $start    = $line;
-                    $filename = $filename_ini;
-                    *dbline   = $main::{ '_<' . $filename };
-                    $max      = $#dbline;
-
-                    # Now where are we?
-                    print_lineinfo($position);
-                    next CMD;
-                }
+        _DB__handle_dot_command($obj);
 
 =head4 C<-> - back one window