2nd try to get the forked debugger working on UNIX/LINUX/CYGWIN and VMS.

In perl5db.pl:

1. Fix so that scripts work on VMS the way that they do on UNIX/LINUX/CYGWIN.

2. Move code to make sure that $term is defined for forked xterms to the xterm_get_fork_TTY instead of in sub TTY.

That prevents it from interfering with debugger scripts.


In perl5db.t:

Since the debugger now supports scripts on VMS, run the test instead of skipping it.



Note 1. Scripting and forked debuggers are not compatible with each other at this time.

Note 2. Closing the forked debugger xterm on CYGWIN hangs the perl interpreter.


To do list:

In VMS, /dev/tty should translate to TT: and the reverse when converting UNIX / VMS names if the logical name TT exists and is a terminal. This conversion is needed in a wrapper to any I/O routine that accesses a filename, so is not a trivial thing to do.

A way to specify (or not) the forked debugger on the command line.

The value of $TERM should have no bearing on if a forked debugger should be created. Requiring a specific value of $TERM just encourages incorrect settings of $TERM.

There is no reason that other X11 terminals instead of xterm could not be used, so there should be a way of specifying which one should be used. If that is done, then VMS.C should be adjusted so that DECterm can be specified.

Thanks,
-John
[EMAIL PROTECTED]
Personal Opinion Only
--- /rsync_root/perl/lib/perl5db.pl     Sat Nov 17 06:56:46 2007
+++ lib/perl5db.pl      Sun Apr 27 23:51:29 2008
@@ -1363,7 +1363,9 @@
 # As noted, this test really doesn't check accurately that the debugger
 # is running at a terminal or not.
 
-if ( -e "/dev/tty" ) {                      # this is the wrong metric!
+my $dev_tty = '/dev/tty';
+   $dev_tty = 'TT:' if ($^O eq 'VMS');
+if ( -e $dev_tty ) {                      # this is the wrong metric!
     $rcfile = ".perldb";
 }
 else {
@@ -6100,6 +6102,16 @@
 
     $pidprompt = '';    # Shown anyway in titlebar
 
+    # We need $term defined or we can not switch to the newly created xterm
+    if ($tty ne '' && !defined $term) {
+        eval { require Term::ReadLine } or die $@;
+        if ( !$rl ) {
+            $term = new Term::ReadLine::Stub 'perldb', $IN, $OUT;
+        }
+        else {
+            $term = new Term::ReadLine 'perldb', $IN, $OUT;
+        }
+    }
     # There's our new TTY.
     return $tty;
 } ## end sub xterm_get_fork_TTY
@@ -6766,18 +6778,6 @@
 
 sub TTY {
 
-    # With VMS we can get here with $term undefined, so we do not
-    # switch to this terminal.  There may be a better place to make
-    # sure that $term is defined on VMS
-    if ( @_ and ($^O eq 'VMS') and !defined($term) ) {
-       eval { require Term::ReadLine } or die $@;
-        if ( !$rl ) {
-           $term = new Term::ReadLine::Stub 'perldb', $IN, $OUT;
-       }
-       else {
-           $term = new Term::ReadLine 'perldb', $IN, $OUT;
-       }
-    }
     if ( @_ and $term and $term->Features->{newTTY} ) {
 
         # This terminal supports switching to a new TTY.
--- /rsync_root/perl/lib/perl5db.t      Tue Sep 25 03:25:08 2007
+++ lib/perl5db.t       Sun Apr 27 23:50:00 2008
@@ -14,8 +14,10 @@
        print "1..0 # Skip: no /dev/null\n";
        exit 0;
     }
-    if (!-c "/dev/tty") {
-       print "1..0 # Skip: no /dev/tty\n";
+my $dev_tty = '/dev/tty';
+   $dev_tty = 'TT:' if ($^O eq 'VMS');
+    if (!-c $dev_tty) {
+       print "1..0 # Skip: no $dev_tty\n";
        exit 0;
     }
 }

Reply via email to