This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Ensure 'q' works in debugger with RemotePort.
authorShlomi Fish <shlomif@cpan.org>
Wed, 2 Dec 2015 23:22:41 +0000 (18:22 -0500)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 2 Dec 2015 23:24:13 +0000 (18:24 -0500)
Patch submitted by Shlomi Fish.

For: RT #126735

lib/perl5db.pl
lib/perl5db.t

index 0d240ae..68f7e50 100644 (file)
@@ -528,7 +528,7 @@ BEGIN {
 # Debugger for Perl 5.00x; perl5db.pl patch level:
 use vars qw($VERSION $header);
 
-$VERSION = '1.49_01';
+$VERSION = '1.49_02';
 
 $header = "perl5db.pl version $VERSION";
 
@@ -2490,7 +2490,11 @@ EOP
 # 'm' is method.
 # 'v' is the value (i.e: method name or subroutine ref).
 # 's' is subroutine.
-my %cmd_lookup =
+my %cmd_lookup;
+
+BEGIN
+{
+    %cmd_lookup =
 (
     '-' => { t => 'm', v => '_handle_dash_command', },
     '.' => { t => 's', v => \&_DB__handle_dot_command, },
@@ -2523,6 +2527,7 @@ my %cmd_lookup =
     (map { $_ => {t => 'm', v => '_handle_cmd_wrapper_commands' }, }
         qw(a A b B e E h i l L M o O v w W)),
 );
+};
 
 sub DB {
 
index 98a3686..0c4fc42 100644 (file)
@@ -29,7 +29,7 @@ BEGIN {
     $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
 }
 
-plan(121);
+plan(123);
 
 my $rc_filename = '.perldb';
 
@@ -2799,6 +2799,22 @@ SKIP:
     );
 }
 
+{
+    # perl 5 RT #126735 regression bug.
+    local $ENV{PERLDB_OPTS} = "NonStop=0 RemotePort=non-existent-host.tld:9001";
+    my $output = runperl( stdin => "q\n", stderr => 1, switches => [ '-d' ], prog => '../lib/perl5db/t/fact' );
+    like(
+        $output,
+        qr/^Unable to connect to remote host:/ms,
+        'Tried to connect.',
+    );
+    unlike(
+        $output,
+        qr/syntax error/,
+        'Can quit from the debugger after a wrong RemotePort',
+    );
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }