1Net::Netrc(3)         User Contributed Perl Documentation        Net::Netrc(3)
2
3
4

NAME

6       Net::Netrc - OO interface to users netrc file
7

SYNOPSIS

9           use Net::Netrc;
10
11           $mach = Net::Netrc->lookup('some.machine');
12           $login = $mach->login;
13           ($login, $password, $account) = $mach->lpa;
14

DESCRIPTION

16       "Net::Netrc" is a class implementing a simple interface to the .netrc
17       file used as by the ftp program.
18
19       "Net::Netrc" also implements security checks just like the ftp program,
20       these checks are, first that the .netrc file must be owned by the user
21       and second the ownership permissions should be such that only the owner
22       has read and write access. If these conditions are not met then a
23       warning is output and the .netrc file is not read.
24
25   The .netrc File
26       The .netrc file contains login and initialization information used by
27       the auto-login process.  It resides in the user's home directory.  The
28       following tokens are recognized; they may be separated by spaces, tabs,
29       or new-lines:
30
31       machine name
32           Identify a remote machine name. The auto-login process searches the
33           .netrc file for a machine token that matches the remote machine
34           specified.  Once a match is made, the subsequent .netrc tokens are
35           processed, stopping when the end of file is reached or an- other
36           machine or a default token is encountered.
37
38       default
39           This is the same as machine name except that default matches any
40           name.  There can be only one default token, and it must be after
41           all machine tokens.  This is normally used as:
42
43               default login anonymous password user@site
44
45           thereby giving the user automatic anonymous login to machines not
46           specified in .netrc.
47
48       login name
49           Identify a user on the remote machine.  If this token is present,
50           the auto-login process will initiate a login using the specified
51           name.
52
53       password string
54           Supply a password.  If this token is present, the auto-login
55           process will supply the specified string if the remote server
56           requires a password as part of the login process.
57
58       account string
59           Supply an additional account password.  If this token is present,
60           the auto-login process will supply the specified string if the
61           remote server requires an additional account password.
62
63       macdef name
64           Define a macro. "Net::Netrc" only parses this field to be
65           compatible with ftp.
66
67   Class Methods
68       The constructor for a "Net::Netrc" object is not called new as it does
69       not really create a new object. But instead is called "lookup" as this
70       is essentially what it does.
71
72       "lookup($machine[, $login])"
73           Lookup and return a reference to the entry for $machine. If $login
74           is given then the entry returned will have the given login. If
75           $login is not given then the first entry in the .netrc file for
76           $machine will be returned.
77
78           If a matching entry cannot be found, and a default entry exists,
79           then a reference to the default entry is returned.
80
81           If there is no matching entry found and there is no default
82           defined, or no .netrc file is found, then "undef" is returned.
83
84   Object Methods
85       "login()"
86           Return the login id for the netrc entry
87
88       "password()"
89           Return the password for the netrc entry
90
91       "account()"
92           Return the account information for the netrc entry
93
94       "lpa()"
95           Return a list of login, password and account information for the
96           netrc entry
97

EXPORTS

99       None.
100

KNOWN BUGS

102       See <https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=libnet>.
103

SEE ALSO

105       Net::Cmd.
106

AUTHOR

108       Graham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>.
109
110       Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining
111       libnet as of version 1.22_02.
112
114       Copyright (C) 1995-1998 Graham Barr.  All rights reserved.
115
116       Copyright (C) 2013-2014, 2020 Steve Hay.  All rights reserved.
117

LICENCE

119       This module is free software; you can redistribute it and/or modify it
120       under the same terms as Perl itself, i.e. under the terms of either the
121       GNU General Public License or the Artistic License, as specified in the
122       LICENCE file.
123

VERSION

125       Version 3.14
126

DATE

128       23 Dec 2020
129

HISTORY

131       See the Changes file.
132
133
134
135perl v5.36.0                      2022-07-22                     Net::Netrc(3)
Impressum