X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FNet%2FNetrc.pm;h=a44b6e319ea485417bab7fdd5f2327144de03109;hb=c798bd2165d7b5d59c62ab6330f7cf77ff8b09dd;hp=0c6331010580d013d2090d8bbb7b285b625bec2f;hpb=406c51eefa6c9c4f403ef7f86adb46a627701935;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Net/Netrc.pm b/lib/Net/Netrc.pm index 0c63310..a44b6e3 100644 --- a/lib/Net/Netrc.pm +++ b/lib/Net/Netrc.pm @@ -11,7 +11,7 @@ use strict; use FileHandle; use vars qw($VERSION); -$VERSION = "2.10"; # $Id: //depot/libnet/Net/Netrc.pm#4$ +$VERSION = "2.12"; # $Id: //depot/libnet/Net/Netrc.pm#12 $ my %netrc = (); @@ -19,7 +19,7 @@ sub _readrc { my $host = shift; my($home,$file); - + if($^O eq "MacOS") { $home = $ENV{HOME} || `pwd`; chomp($home); @@ -27,6 +27,7 @@ sub _readrc } else { # Some OS's don't have `getpwuid', so we default to $ENV{HOME} $home = eval { (getpwuid($>))[7] } || $ENV{HOME}; + $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH}||'') if defined $ENV{HOMEDRIVE}; $file = $home . "/.netrc"; } @@ -37,7 +38,10 @@ sub _readrc $netrc{default} = undef; # OS/2 and Win32 do not handle stat in a way compatable with this check :-( - unless($^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'MacOS') + unless($^O eq 'os2' + || $^O eq 'MSWin32' + || $^O eq 'MacOS' + || $^O =~ /^cygwin/) { my @stat = stat($file); @@ -199,7 +203,7 @@ Net::Netrc - OO interface to users netrc file =head1 SYNOPSIS use Net::Netrc; - + $mach = Net::Netrc->lookup('some.machine'); $login = $mach->login; ($login, $password, $account) = $mach->lpa; @@ -284,6 +288,9 @@ the first entry in the .netrc file for C will be returned. If a matching entry cannot be found, and a default entry exists, then a reference to the default entry is returned. +If there is no matching entry found and there is no default defined, or +no .netrc file is found, then C is returned. + =back =head1 METHODS @@ -323,4 +330,8 @@ Copyright (c) 1995-1998 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. +=for html
+ +$Id: //depot/libnet/Net/Netrc.pm#12 $ + =cut