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

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

CONSTRUCTOR

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
74           "LOGIN" is given then the entry returned will have the given login.
75           If "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

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

AUTHOR

99       Graham Barr <gbarr@pobox.com>.
100
101       Steve Hay <shay@cpan.org> is now maintaining libnet as of version
102       1.22_02.
103

SEE ALSO

105       Net::Netrc, Net::Cmd
106
108       Copyright (C) 1995-1998 Graham Barr.  All rights reserved.
109
110       Copyright (C) 2013-2014 Steve Hay.  All rights reserved.
111

LICENCE

113       This module is free software; you can redistribute it and/or modify it
114       under the same terms as Perl itself, i.e. under the terms of either the
115       GNU General Public License or the Artistic License, as specified in the
116       LICENCE file.
117
118
119
120perl v5.28.0                      2017-11-14                     Net::Netrc(3)
Impressum