From: Daniel S. Lewart Date: Tue, 22 May 2001 23:34:41 +0000 (-0500) Subject: Avoid -W warnings in Tgetent and Tputs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e14c93b34ddde68fbc181b06ddea24be4965fadf;p=p5sagit%2Fp5-mst-13.2.git Avoid -W warnings in Tgetent and Tputs Message-ID: <20010522233441.A12431@staff1.cso.uiuc.edu> p4raw-id: //depot/perl@10183 --- diff --git a/lib/Term/Cap.pm b/lib/Term/Cap.pm index 6d31ab7..70376a6 100644 --- a/lib/Term/Cap.pm +++ b/lib/Term/Cap.pm @@ -1,9 +1,13 @@ package Term::Cap; use Carp; -our $VERSION = '1.00'; +our $VERSION = '1.01'; -# Last updated: Thu Nov 30 23:34:29 EST 2000 by schwern@pobox.com +# 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 +# [PATCH] $VERSION crusade, strict, tests, etc... all over lib/ +# Version 1.01: Wed May 23 00:00:00 CST 2001 by d-lewart@uiuc.edu +# Avoid warnings in Tgetent and Tputs # TODO: # support Berkeley DB termcaps @@ -204,7 +208,7 @@ sub Tgetent { ## public -- static method } } defined $entry or $entry = ''; - $entry .= $_; + $entry .= $_ if $_; }; while ($state != 0) { @@ -307,8 +311,11 @@ sub Tputs { ## public $string = Tpad($self, $self->{'_' . $cap}, $cnt); } else { # cache result because Tpad can be slow - $string = defined $self->{$cap} ? $self->{$cap} : - ($self->{$cap} = Tpad($self, $self->{'_' . $cap}, 1)); + unless (exists $self->{$cap}) { + $self->{$cap} = exists $self->{"_$cap"} ? + Tpad($self, $self->{"_$cap"}, 1) : undef; + } + $string = $self->{$cap}; } print $FH $string if $FH; $string;