develooper Front page | perl.vmsperl | Postings from December 2001

[PATCH Term::Cap] VMS mods

Thread Next
From:
lane
Date:
December 3, 2001 12:39
Subject:
[PATCH Term::Cap] VMS mods
Message ID:
011203154217.82ac1@DUPHY4.Physics.Drexel.Edu
We're getting a working Term::Cap for VMS, slowly but surely...

Here's a patch to the Term::Cap included in Perl@13419:

    o   read the fixed termcap __DATA__ into a variable during module
        loading, for later use by Tgetent

    o   update $VERSION

    o   Term::Cap test actually works on VMS, so allow it to run
        but skip the "bad termcap test" since with a fixed termcap
        we never get the bad data.

    o   typo fix

diff -uBb lib/Term/Cap.pm-orig lib/Term/Cap.pm
--- lib/Term/Cap.pm-orig	Mon Dec  3 13:45:45 2001
+++ lib/Term/Cap.pm	Mon Dec  3 13:45:36 2001
@@ -2,9 +2,9 @@
 
 use Carp;
 
-use vars qw($VERSION);
+use vars qw($VERSION $VMS_TERMCAP);
 
-$VERSION = '1.03';
+$VERSION = '1.05';
 
 # Version undef: Thu Dec 14 20:02:42 CST 1995 by sanders@bsdi.com
 # Version 1.00:  Thu Nov 30 23:34:29 EST 2000 by schwern@pobox.com
@@ -19,6 +19,8 @@
 #       VMS Support from Charles Lane <lane@DUPHY4.Physics.Drexel.Edu>
 # Version 1.04:  Thu Nov 29 16:22:03 GMT 2001
 #       Fixed warnings in test
+# Version 1.05:  Mon Dec 3 2001 
+#       VMS preload termcap data
 
 # TODO:
 # support Berkeley DB termcaps
@@ -190,8 +192,7 @@
 	local $ENV{TERM} = $term;
 
          if ( $^O eq 'VMS' ) {
-	     chomp(my @entry = <DATA>);
-	     $entry = join '', @entry;
+	     $entry = $VMS_TERMCAP;
          }
          else {
 	     eval
@@ -603,6 +604,15 @@
 
 # Below is a default entry for systems where there are terminals but no
 # termcap
+#
+# and on start up we read and store it for later use.
+#
+if ($^O eq 'VMS') {
+    chomp(my @entry = <DATA>);
+    $VMS_TERMCAP = join '', @entry;  
+    close(DATA);
+}
+
 1;
 __DATA__
 vt220|vt200|DEC VT220 in vt100 emulation mode:
diff -uBb lib/Term/Cap.t-orig lib/Term/Cap.t
--- lib/Term/Cap.t-orig	Mon Dec  3 15:24:28 2001
+++ lib/Term/Cap.t	Mon Dec  3 15:23:54 2001
@@ -24,7 +24,7 @@
 	( $ENV{HOME} . '/.termcap', # we assume pretty UNIXy system anyway
 	  '/etc/termcap', 
 	  '/usr/share/misc/termcap' );
-unless( $files ) {
+unless( $files || $^O eq 'VMS') {
     plan skip_all => 'no termcap available to test';
 }
 else {
@@ -110,12 +110,15 @@
 is( $warn, '', 'Tgetent() should not work if OSPEED is provided' );
 is( $vals->{PADDING}, 200, 'Tgetent() should set slow PADDING when needed' );
 
+SKIP: {
+    skip("Tgetent() bad termcap test, since using a fixed termcap",1) if $^O eq 'VMS';
 # now see if lines 177 or 180 will fail
 $ENV{TERM} = 'foo';
 $ENV{TERMPATH} = '!';
 $ENV{TERMCAP} = '';
 eval { $t = Term::Cap->Tgetent($vals) };
 isn't( $@, '', 'Tgetent() should catch bad termcap file' );
+}
 
 SKIP: {
 	skip( "Can't write 'tcout' file for tests", 9 ) unless $writable;
@@ -159,7 +162,7 @@
 	'Tgoto() should handle %. and magic' );
 
 $t->{_test} = 'a%+';
-like( $t->Tgoto('test', '', 1), qr/a\x01/, 'Tgoto() shoudl handle %+' );
+like( $t->Tgoto('test', '', 1), qr/a\x01/, 'Tgoto() should handle %+' );
 $t->{_test} = 'a%+a';
 is( $t->Tgoto('test', '', 1), 'ab', 'Tgoto() should handle %+char' );
 $t->{_test} .= 'a' x 99;
--
 Drexel University       \V                    --Chuck Lane
======]---------->--------*------------<-------[===========
     (215) 895-1545     _/ \  Particle Physics
FAX: (215) 895-5934     /\ /~~~~~~~~~~~        lane@duphy4.physics.drexel.edu

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About