10 my $file = (getpwuid($>))[7] . "/.netrc";
11 my($login,$pass,$acct) = (undef,undef,undef);
15 $netrc{default} = undef;
17 my @stat = stat($file);
23 carp "Bad permissions: $file";
28 carp "Not owner: $file";
35 my($mach,$macdef,$tok,@tok) = (0,0);
39 undef $macdef if /\A\n\Z/;
47 push(@tok, split(/[\s\n]+/, $_));
52 if($tok[0] eq "default")
55 $mach = $netrc{default} = {};
60 last TOKEN unless @tok > 1;
65 my $host = shift @tok;
66 $mach = $netrc{$host} = {};
68 elsif($tok =~ /^(login|password|account)$/)
70 next TOKEN unless $mach;
71 my $value = shift @tok;
74 elsif($tok eq "macdef")
76 next TOKEN unless $mach;
77 my $value = shift @tok;
78 $mach->{macdef} = {} unless exists $mach->{macdef};
79 $macdef = $mach->{machdef}{$value} = [];
91 _readrc() unless exists $netrc{default};
93 return bless \$mach if exists $netrc{$mach};
95 return bless \("default") if defined $netrc{default};
103 exists $me->{login} ? $me->{login} : undef;
109 exists $me->{account} ? $me->{account} : undef;
115 exists $me->{password} ? $me->{password} : undef;
120 ($me->login, $me->password, $me->account);