From 962e816ab0bdb692bb446f3f7ffa7b271a1b5520 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 6 Nov 2023 08:11:11 +0000 Subject: [PATCH] simplify $ENV{TERMCAP} handling: don't bother setting anything if the variable doesn't exist --- gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm | 13 ++++++------- 1 file 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(); -- 2.20.1