From: Jarkko Hietaniemi Date: Tue, 26 Jun 2001 13:43:51 +0000 (+0000) Subject: Be more portable in finding out the home directory, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b27238ebb2d98f4c4edac4b768c952eb91ee2c3a;p=p5sagit%2Fp5-mst-13.2.git Be more portable in finding out the home directory, and use File::Spec to do the concat. (Come to think of it, couldn't File::Spec provide for a ->homedir method?) p4raw-id: //depot/perl@10962 --- diff --git a/lib/Net/Config.pm b/lib/Net/Config.pm index 30a65fd..e0dd1d9 100644 --- a/lib/Net/Config.pm +++ b/lib/Net/Config.pm @@ -40,8 +40,9 @@ if ( -f $file ) { } } if ($< == $> and !$CONFIGURE) { - my $home = eval { (getpwuid($>))[7] } || $ENV{HOME}; - $file = $home . "/.libnetrc"; + use File::Spec; + my $home = eval { (getpwuid($>))[7] } || $ENV{HOME} || $ENV{HOMEDRIVE} || $ENV{HOMEPATH} || File::Spec->curdir; + $file = File::Spec->catfile($home, ".libnetrc"); $ref = eval { do $file } if -f $file; %NetConfig = (%NetConfig, %{ $ref }) if ref($ref) eq 'HASH';