Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 15062
Status: resolved
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: tshinnic [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.12
Fixed in: (no value)



Subject: Accidental autovivification of $ENV{TMPDIR} under Windows
I was getting uninitialized value errors on use of %ENV. I tracked it down to the use of tmpdir() under Windows. Then tracked it down to this line in File::Spec::Win32, $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, This has the unintended effect of autovivifying $ENV{TMPDIR}, which environment variable is not previously defined on my system. That is, using a slice in a subroutine call will autovivify any hash values not previously defined. (I was stunned, yes, but please refer to discussion at http://www.perlmonks.com/?node_id=500136. I suppose this has been discussed to death on P5P?) The 'fix' would be to change this to: $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, $ENV{TEMP}, $ENV{TMP}, I have tested this under Windows XP and ActiveState Perl 5.8.7 build 813 and it corrected the uninitialized errors problem I was seeing.
Hi Thomas, Thanks for finding this. I'll make the change. This does seem like a perl bug. Here are a couple of one-liners that show what's going on: % perl -le 'sub foo{} foo(@x{'a','b'}); print for keys %x' b a % perl -le 'sub foo{} foo($x{a},$x{b}); print for keys %x' % perl -le 'sub foo{$_=5 for @_} foo($x{a},$x{b}); print for keys %x' a b I can make the change in PathTools, and I've also submitted this as a bug in perl. -Ken [guest - Fri Oct 14 15:09:19 2005]: Show quoted text
> I was getting uninitialized value errors on use of %ENV. I tracked it > down to the use of tmpdir() under Windows. Then tracked it down to > this line in File::Spec::Win32, > $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)}, > > This has the unintended effect of autovivifying $ENV{TMPDIR}, which > environment variable is not previously defined on my system. That > is, using a slice in a subroutine call will autovivify any hash > values not previously defined. (I was stunned, yes, but please > refer to discussion at http://www.perlmonks.com/?node_id=500136. I > suppose this has been discussed to death on P5P?) > > The 'fix' would be to change this to: > $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, > $ENV{TEMP}, > $ENV{TMP}, > > I have tested this under Windows XP and ActiveState Perl 5.8.7 build > 813 and it corrected the uninitialized errors problem I was seeing.