From: Jonathan Stowe Date: Thu, 29 Nov 2001 16:31:24 +0000 (+0000) Subject: (was Re: warnings from [PATCH Perl@13013] Term::Cap and VMS ) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2608af5d2f1e161b0f716f20290649e347b4a3a4;p=p5sagit%2Fp5-mst-13.2.git (was Re: warnings from [PATCH Perl@13013] Term::Cap and VMS ) Message-ID: p4raw-id: //depot/perl@13368 --- diff --git a/lib/Term/Cap.pm b/lib/Term/Cap.pm index 3686316..69a2f5e 100644 --- a/lib/Term/Cap.pm +++ b/lib/Term/Cap.pm @@ -17,6 +17,8 @@ $VERSION = '1.03'; # Fixed no argument Tgetent() # Version 1.03: Wed Nov 28 10:09:38 GMT 2001 # VMS Support from Charles Lane +# Version 1.04: Thu Nov 29 16:22:03 GMT 2001 +# Fixed warnings in test # TODO: # support Berkeley DB termcaps @@ -276,19 +278,19 @@ sub Tgetent { ## public -- static method # Precompile $entry into the object $entry =~ s/^[^:]*://; foreach $field (split(/:[\s:\\]*/,$entry)) { - if ($field =~ /^(\w\w)$/) { + if (defined $field && $field =~ /^(\w\w)$/) { $self->{'_' . $field} = 1 unless defined $self->{'_' . $1}; # print STDERR "DEBUG: flag $1\n"; } - elsif ($field =~ /^(\w\w)\@/) { + elsif (defined $field && $field =~ /^(\w\w)\@/) { $self->{'_' . $1} = ""; # print STDERR "DEBUG: unset $1\n"; } - elsif ($field =~ /^(\w\w)#(.*)/) { + elsif (defined $field && $field =~ /^(\w\w)#(.*)/) { $self->{'_' . $1} = $2 unless defined $self->{'_' . $1}; # print STDERR "DEBUG: numeric $1 = $2\n"; } - elsif ($field =~ /^(\w\w)=(.*)/) { + elsif (defined $field && $field =~ /^(\w\w)=(.*)/) { # print STDERR "DEBUG: string $1 = $2\n"; next if defined $self->{'_' . ($cap = $1)}; $_ = $2; @@ -349,7 +351,7 @@ sub Tpad { ## public my($string, $cnt, $FH) = @_; my($decr, $ms); - if ($string =~ /(^[\d.]+)(\*?)(.*)$/) { + if (defined $string && $string =~ /(^[\d.]+)(\*?)(.*)$/) { $ms = $1; $ms *= $cnt if $2; $string = $3;