_handle_cmd_wrapper_commands to %cmd_lookup.
authorShlomi Fish <shlomif@shlomifish.org>
Sun, 14 Oct 2012 14:32:47 +0000 (16:32 +0200)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:41 +0000 (09:18 -0500)
This is part of the ongoing perl5db.pl refactoring.

lib/perl5db.pl

index 2144a0b..16319cf 100644 (file)
@@ -2451,6 +2451,8 @@ my %cmd_lookup =
     (map { $_ =>
         { t => 's', v => \&_DB__handle_restart_and_rerun_commands, },
         } qw(R rerun)),
+    (map { $_ => {t => 'm', v => '_handle_cmd_wrapper_commands' }, }
+    qw(a A b B e E h i l L M o O P v w W)),
 );
 
 sub DB {
@@ -2772,6 +2774,11 @@ environment, and executing with the last value of C<$?>.
 
 =cut
 
+                # All of these commands were remapped in perl 5.8.0;
+                # we send them off to the secondary dispatcher (see below).
+                $obj->_handle_special_char_cmd_wrapper_commands;
+                $i = _DB__trim_command_and_return_first_component();
+
                 if (my $cmd_rec = $cmd_lookup{$i}) {
                     my $type = $cmd_rec->{t};
                     my $val = $cmd_rec->{v};
@@ -2835,12 +2842,6 @@ retain the old commands for those who were used to using them or who preferred
 them. At this point, we check for the new commands and call C<cmd_wrapper> to
 deal with them instead of processing them in-line.
 
-=cut
-
-                # All of these commands were remapped in perl 5.8.0;
-                # we send them off to the secondary dispatcher (see below).
-                $obj->_handle_cmd_wrapper_commands;
-
 =head4 C<y> - List lexicals in higher scope
 
 Uses C<PadWalker> to find the lexicals supplied as arguments in a scope
@@ -3442,6 +3443,7 @@ sub _handle_dash_command {
 
         # Generate and execute a "l +" command (handled below).
         $DB::cmd = 'l ' . ($start) . '+';
+        redo CMD;
     }
     return;
 }
@@ -3895,13 +3897,27 @@ sub _handle_cmd_wrapper_commands {
 
     # All of these commands were remapped in perl 5.8.0;
     # we send them off to the secondary dispatcher (see below).
-    if (my ($cmd_letter, $my_arg) = $DB::cmd =~ /\A([aAbBeEhilLMoOPvwW]\b|[<>\{]{1,2})\s*(.*)/so) {
+    if (my ($cmd_letter, $my_arg) = $DB::cmd =~ /\A([aAbBeEhilLMoOPvwW]\b)\s*(.*)/so) {
+        DB::cmd_wrapper( $cmd_letter, $my_arg, $line );
+        next CMD;
+    }
+
+    return;
+}
+
+sub _handle_special_char_cmd_wrapper_commands {
+    my $self = shift;
+
+    # All of these commands were remapped in perl 5.8.0;
+    # we send them off to the secondary dispatcher (see below).
+    if (my ($cmd_letter, $my_arg) = $DB::cmd =~ /\A([<>\{]{1,2})\s*(.*)/so) {
         DB::cmd_wrapper( $cmd_letter, $my_arg, $line );
         next CMD;
     }
 
     return;
 }
+
 package DB;
 
 # The following code may be executed now: