Subject: | undefined CLICOLOR causes warnings |
On Fri, June 3, 2005 14:26, Phil Pennock said:
Show quoted text
> The module Env::PS1 has a dependency upon the environment variable
> 'CLICOLOR' being defined, to avoid spurious undef reference warnings. This
> is confirmed in revision 0.05 (looks like the latest on search.cpan.org).
>
> The whitespace in this diff is almost certainly broken, but the problem's
> easy enough to fix that I've only included the patch for illustration.
> Line 44 needs an exists check on $ENV{CLICOLOR} before referencing it.
-----------------------------< cut here >-------------------------------
--- PS1.pm Fri Jun 3 12:19:58 2005
+++ /usr/local/lib/perl5/site_perl/5.8.6/Env/PS1.pm Fri Jun 3 12:20:32 2005
@@ -41,7 +41,8 @@
$format =~ s#(\\\\)|(?<!\\)\$(?:(\w+)|\{(.*?)\})#
$1 ? '\\\\' : $2 ? $ENV{$2} : $ENV{$3}
#ge;
- unless ($format eq $$self{format} and $ENV{CLICOLOR} eq $$self{clicolor}) {
+ unless ($format eq $$self{format} and exists $ENV{CLICOLOR}
+ and $ENV{CLICOLOR} eq $$self{clicolor}) {
@$self{qw/format clicolor/} = ($format, $ENV{CLICOLOR});
$$self{cache} = [ $self->cache($format) ];
}
-----------------------------< cut here >-------------------------------