riemann42 / Music-Tag

Extendable module for working with Music Tags.
Other
3 stars 3 forks source link

Uninitialized value $ENV{"HOME"} on windows systems #6

Open thawn opened 7 years ago

thawn commented 7 years ago

On a windows system, I get the following warning when I use Music::Tag: Use of uninitialized value $ENV{"HOME"} in concatenation (.) or string at C:/Strawberry/perl/site/lib/Music/Tag.pm line 1066.

This is due to the fact that $ENV{"HOME"} is indeed not initialized on a windows system. I tried the following hack at the beginning of my code but that did not work because perl scans Music::Tag before executing any of my code:

if ( $^O =~ /MSWin/ ) { if ( ! $ENV{'HOME'} ) { if ( $ENV{'USERPROFILE'} ) { $ENV{'HOME'} = $ENV{'USERPROFILE'}; } elsif ( $ENV{'HOMEDRIVE'} and $ENV{'HOMEPATH'} ) { $ENV{'HOME'} = $ENV{'HOMEDRIVE'} . $ENV{'HOMEPATH'}; } } } Maybe you could use something like this to fix the warning?