Be more portable in finding out the home directory,
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 26 Jun 2001 13:43:51 +0000 (13:43 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 26 Jun 2001 13:43:51 +0000 (13:43 +0000)
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

lib/Net/Config.pm

index 30a65fd..e0dd1d9 100644 (file)
@@ -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';