| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "Net::Netrc 3perl" |
| 58 |
.TH Net::Netrc 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Net::Netrc \- OO interface to users netrc file |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& use Net::Netrc; |
| 69 |
\& |
| 70 |
\& $mach = Net::Netrc\->lookup(\*(Aqsome.machine\*(Aq); |
| 71 |
\& $login = $mach\->login; |
| 72 |
\& ($login, $password, $account) = $mach\->lpa; |
| 73 |
.Ve |
| 74 |
.SH DESCRIPTION |
| 75 |
.IX Header "DESCRIPTION" |
| 76 |
\&\f(CW\*(C`Net::Netrc\*(C'\fR is a class implementing a simple interface to the .netrc file |
| 77 |
used as by the ftp program. |
| 78 |
.PP |
| 79 |
\&\f(CW\*(C`Net::Netrc\*(C'\fR also implements security checks just like the ftp program, |
| 80 |
these checks are, first that the .netrc file must be owned by the user and |
| 81 |
second the ownership permissions should be such that only the owner has |
| 82 |
read and write access. If these conditions are not met then a warning is |
| 83 |
output and the .netrc file is not read. |
| 84 |
.SS "The \fI.netrc\fP File" |
| 85 |
.IX Subsection "The .netrc File" |
| 86 |
The .netrc file contains login and initialization information used by the |
| 87 |
auto-login process. It resides in the user's home directory. The following |
| 88 |
tokens are recognized; they may be separated by spaces, tabs, or new-lines: |
| 89 |
.IP "machine name" 4 |
| 90 |
.IX Item "machine name" |
| 91 |
Identify a remote machine name. The auto-login process searches |
| 92 |
the .netrc file for a machine token that matches the remote machine |
| 93 |
specified. Once a match is made, the subsequent .netrc tokens |
| 94 |
are processed, stopping when the end of file is reached or an\- |
| 95 |
other machine or a default token is encountered. |
| 96 |
.IP default 4 |
| 97 |
.IX Item "default" |
| 98 |
This is the same as machine name except that default matches |
| 99 |
any name. There can be only one default token, and it must be |
| 100 |
after all machine tokens. This is normally used as: |
| 101 |
.Sp |
| 102 |
.Vb 1 |
| 103 |
\& default login anonymous password user@site |
| 104 |
.Ve |
| 105 |
.Sp |
| 106 |
thereby giving the user automatic anonymous login to machines |
| 107 |
not specified in .netrc. |
| 108 |
.IP "login name" 4 |
| 109 |
.IX Item "login name" |
| 110 |
Identify a user on the remote machine. If this token is present, |
| 111 |
the auto-login process will initiate a login using the |
| 112 |
specified name. |
| 113 |
.IP "password string" 4 |
| 114 |
.IX Item "password string" |
| 115 |
Supply a password. If this token is present, the auto-login |
| 116 |
process will supply the specified string if the remote server |
| 117 |
requires a password as part of the login process. |
| 118 |
.IP "account string" 4 |
| 119 |
.IX Item "account string" |
| 120 |
Supply an additional account password. If this token is present, |
| 121 |
the auto-login process will supply the specified string |
| 122 |
if the remote server requires an additional account password. |
| 123 |
.IP "macdef name" 4 |
| 124 |
.IX Item "macdef name" |
| 125 |
Define a macro. \f(CW\*(C`Net::Netrc\*(C'\fR only parses this field to be compatible |
| 126 |
with \fIftp\fR. |
| 127 |
.SS "Class Methods" |
| 128 |
.IX Subsection "Class Methods" |
| 129 |
The constructor for a \f(CW\*(C`Net::Netrc\*(C'\fR object is not called new as it does not |
| 130 |
really create a new object. But instead is called \f(CW\*(C`lookup\*(C'\fR as this is |
| 131 |
essentially what it does. |
| 132 |
.ie n .IP """lookup($machine[, $login])""" 4 |
| 133 |
.el .IP "\f(CWlookup($machine[, $login])\fR" 4 |
| 134 |
.IX Item "lookup($machine[, $login])" |
| 135 |
Lookup and return a reference to the entry for \f(CW$machine\fR. If \f(CW$login\fR is given |
| 136 |
then the entry returned will have the given login. If \f(CW$login\fR is not given then |
| 137 |
the first entry in the .netrc file for \f(CW$machine\fR will be returned. |
| 138 |
.Sp |
| 139 |
If a matching entry cannot be found, and a default entry exists, then a |
| 140 |
reference to the default entry is returned. |
| 141 |
.Sp |
| 142 |
If there is no matching entry found and there is no default defined, or |
| 143 |
no .netrc file is found, then \f(CW\*(C`undef\*(C'\fR is returned. |
| 144 |
.SS "Object Methods" |
| 145 |
.IX Subsection "Object Methods" |
| 146 |
.ie n .IP login() 4 |
| 147 |
.el .IP \f(CWlogin()\fR 4 |
| 148 |
.IX Item "login()" |
| 149 |
Return the login id for the netrc entry |
| 150 |
.ie n .IP password() 4 |
| 151 |
.el .IP \f(CWpassword()\fR 4 |
| 152 |
.IX Item "password()" |
| 153 |
Return the password for the netrc entry |
| 154 |
.ie n .IP account() 4 |
| 155 |
.el .IP \f(CWaccount()\fR 4 |
| 156 |
.IX Item "account()" |
| 157 |
Return the account information for the netrc entry |
| 158 |
.ie n .IP lpa() 4 |
| 159 |
.el .IP \f(CWlpa()\fR 4 |
| 160 |
.IX Item "lpa()" |
| 161 |
Return a list of login, password and account information for the netrc entry |
| 162 |
.SH EXPORTS |
| 163 |
.IX Header "EXPORTS" |
| 164 |
\&\fINone\fR. |
| 165 |
.SH "KNOWN BUGS" |
| 166 |
.IX Header "KNOWN BUGS" |
| 167 |
See <https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=libnet>. |
| 168 |
.SH "SEE ALSO" |
| 169 |
.IX Header "SEE ALSO" |
| 170 |
Net::Cmd. |
| 171 |
.SH AUTHOR |
| 172 |
.IX Header "AUTHOR" |
| 173 |
Graham Barr <[email protected] <mailto:[email protected]>>. |
| 174 |
.PP |
| 175 |
Steve Hay <[email protected] <mailto:[email protected]>> is now maintaining |
| 176 |
libnet as of version 1.22_02. |
| 177 |
.SH COPYRIGHT |
| 178 |
.IX Header "COPYRIGHT" |
| 179 |
Copyright (C) 1995\-1998 Graham Barr. All rights reserved. |
| 180 |
.PP |
| 181 |
Copyright (C) 2013\-2014, 2020 Steve Hay. All rights reserved. |
| 182 |
.SH LICENCE |
| 183 |
.IX Header "LICENCE" |
| 184 |
This module is free software; you can redistribute it and/or modify it under the |
| 185 |
same terms as Perl itself, i.e. under the terms of either the GNU General Public |
| 186 |
License or the Artistic License, as specified in the \fILICENCE\fR file. |
| 187 |
.SH VERSION |
| 188 |
.IX Header "VERSION" |
| 189 |
Version 3.15 |
| 190 |
.SH DATE |
| 191 |
.IX Header "DATE" |
| 192 |
20 March 2023 |
| 193 |
.SH HISTORY |
| 194 |
.IX Header "HISTORY" |
| 195 |
See the \fIChanges\fR file. |