我有以下代码,但我认为我需要清理环境变量,但我不确定我应该如何清理它们。我意识到我可以对它们进行消毒的程度可能是有限的,但我能做些什么呢?
#!/usr/bin/perl
use 5.012;
use warnings;
use autodie;
use Env qw( EDITOR VISUAL );
use File::Temp qw( :seekable );
my $editor = '/usr/bin/nano';
if ( $VISUAL ) {
$editor = $VISUAL;
}
elsif ( $EDITOR ) {
$editor = $EDITOR;
} else {
warn 'set VISUAL and EDITOR env variables not set falling back to nano'
. "\n";
}
my $tmpf = File::Temp->new;
system $editor, $tmpf->filename;
open $tmpf, '<', $tmpf->filename;
print while ( <$tmpf> );