Skip Menu |

This queue is for tickets about the local-lib CPAN distribution.

Report information
The Basics
Id: 84621
Status: resolved
Priority: 0/
Queue: local-lib

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.008009
Fixed in: 1.008010



Subject: _env_list_value tries to split existing but undefined environment variables
_env_list_value doesn't recognize an existing but undefined environment variable and tries to split it at line 408, resulting in a warning. (This happens when called by perlbrew with an environment variable set to undef to deactivate it.) 407 if (ref $_ eq 'SCALAR' && $options{interpolate} == INTERPOLATE_ENV) { 408 exists $ENV{${$_}} ? (split /\Q$Config{path_sep}/, $ENV{${$_}}) : () 409 } else { 410 $_ 411 } Adding a defined check 408 exists $ENV{${$_}} && defined $ENV{${$_}} ? (split /\Q$Config{path_sep}/, $ENV{${$_}}) : () should fix it.
On Sat Apr 13 23:38:02 2013, DJERIUS wrote: Show quoted text
> _env_list_value doesn't recognize an existing but undefined > environment variable and tries to split it at line 408, resulting > in a warning. (This happens when called by perlbrew with an > environment variable set to undef to deactivate it.)
I'm not sure this is a bug. Setting $ENV{FOO} = undef is not the same as having the value unset -- you should probably delete $ENV{FOO} instead.
On Tue Apr 16 23:09:56 2013, ETHER wrote: Show quoted text
> On Sat Apr 13 23:38:02 2013, DJERIUS wrote:
> > _env_list_value doesn't recognize an existing but undefined > > environment variable and tries to split it at line 408, resulting > > in a warning. (This happens when called by perlbrew with an > > environment variable set to undef to deactivate it.)
> > I'm not sure this is a bug. Setting $ENV{FOO} = undef is not the same as > having the value unset -- you should probably delete $ENV{FOO} instead. >
It seems I've left out some context. perlbrew (which I'm not the author of, and who has not been cc'd on this) uses the undef value as a semaphore to indicate that in later processing it needs to remove that environment variable from the user's environment. That seems a legitimate and efficient approach, as it avoids the requirement for an additional structure to keep track of which variables need to be deleted (deleting the variable from %ENV erases that information). I would argue that _env_list_value should be more robust against vagaries in its input. %ENV _is_ special in that it typically contains only scalars (so I wouldn't expect _env_list_value to concern itself about elements containing references), but guarding against undef values seems like a minor burden which greatly simplifies code which uses local::lib.
Has been fixed since 1.008010.