summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2023-11-06 08:11:12 +0000
committerMarc Espie <espie@cvs.openbsd.org>2023-11-06 08:11:12 +0000
commit237cbe07181bb7e4ae4514891a79f5e9d894c407 (patch)
tree7abf068bbfe3c5dbe0ba17d3fb4023dc4d8c7d7d /gnu/usr.bin
parent72744caceda4785cc6d10b2f0e1b4c91802696c4 (diff)
simplify $ENV{TERMCAP} handling: don't bother setting anything if
the variable doesn't exist
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm b/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm
index 6ff37482ce5..5d3d296a17e 100644
--- a/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm
+++ b/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm
@@ -222,13 +222,12 @@ sub Tgetent
$tmp_term = $self->{TERM};
my $seen = {};
- my $foo = ( exists $ENV{TERMCAP} ? $ENV{TERMCAP} : '' );
-
- # $entry is the extracted termcap entry
- if ( ( $foo !~ m:^/:s ) && ( $foo =~ m/(^|\|)\Q$tmp_term\E[:|]/s ) )
- {
- $entry = $foo;
- $seen->{$tmp_term} = 1;
+ if (exists $ENV{TERMCAP}) {
+ local $_ = $ENV{TERMCAP};
+ if ( !m:^/:s && m/(^|\|)\Q$tmp_term\E[:|]/s ) {
+ $entry = $_;
+ $seen->{$tmp_term} = 1;
+ }
}
my @termcap_path = termcap_path();