Convert up to _DB__handle_y_command to cmd_args.
authorShlomi Fish <shlomif@shlomifish.org>
Tue, 16 Oct 2012 09:05:10 +0000 (11:05 +0200)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:42 +0000 (09:18 -0500)
lib/perl5db.pl

index cfea59e..acdbf82 100644 (file)
@@ -1920,7 +1920,7 @@ sub _DB__handle_y_command {
     my ($obj) = @_;
 
     if (my ($match_level, $match_vars)
-        = $cmd =~ /^y(?:\s+(\d*)\s*(.*))?$/) {
+        = $obj->cmd_args =~ /\A(?:(\d*)\s*(.*))?\z/) {
 
         # See if we've got the necessary support.
         if (!eval { require PadWalker; PadWalker->VERSION(0.08) }) {
@@ -3343,7 +3343,11 @@ number information, and print that.
 }
 
 sub _handle_t_command {
-    if (my ($levels) = $DB::cmd =~ /\At(?:\s+(\d+))?\z/) {
+    my $self = shift;
+
+    my $levels = $self->cmd_args();
+
+    if ((!length($levels)) or ($levels !~ /\D/)) {
         $trace ^= 1;
         local $\ = '';
         $DB::trace_to_depth = $levels ? $stack_depth + $levels : 1E9;
@@ -3540,10 +3544,10 @@ sub _handle_T_command {
 }
 
 sub _handle_w_command {
-    if (my ($arg) = $DB::cmd =~ /\Aw\b\s*(.*)/s) {
-        DB::cmd_w( 'w', $arg );
-        next CMD;
-    }
+    my $self = shift;
+
+    DB::cmd_w( 'w', $self->cmd_args() );
+    next CMD;
 
     return;
 }