diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2023-11-06 08:11:12 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2023-11-06 08:11:12 +0000 |
commit | 237cbe07181bb7e4ae4514891a79f5e9d894c407 (patch) | |
tree | 7abf068bbfe3c5dbe0ba17d3fb4023dc4d8c7d7d /gnu/usr.bin/perl | |
parent | 72744caceda4785cc6d10b2f0e1b4c91802696c4 (diff) |
simplify $ENV{TERMCAP} handling: don't bother setting anything if
the variable doesn't exist
Diffstat (limited to 'gnu/usr.bin/perl')
-rw-r--r-- | gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm | 13 |
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(); |