Net::Netrc(3p) Perl Programmers Reference Guide Net::Netrc(3p)

Net::Netrc(3p) Perl Programmers Reference Guide Net::Netrc(3p) #

Net::Netrc(3p) Perl Programmers Reference Guide Net::Netrc(3p)

NNAAMMEE #

 Net::Netrc - OO interface to users netrc file

SSYYNNOOPPSSIISS #

     use Net::Netrc;

     $mach = Net::Netrc->lookup('some.machine');
     $login = $mach->login;
     ($login, $password, $account) = $mach->lpa;

DDEESSCCRRIIPPTTIIOONN #

 "Net::Netrc" is a class implementing a simple interface to the .netrc
 file used as by the ftp program.

 "Net::Netrc" also implements security checks just like the ftp program,
 these checks are, first that the .netrc file must be owned by the user
 and second the ownership permissions should be such that only the owner
 has read and write access. If these conditions are not met then a warning
 is output and the .netrc file is not read.

TThhee _._n_e_t_r_c FFiillee The .netrc file contains login and initialization information used by the auto-login process. It resides in the user’s home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines:

 machine name
     Identify a remote machine name. The auto-login process searches the
     .netrc file for a machine token that matches the remote machine
     specified.  Once a match is made, the subsequent .netrc tokens are
     processed, stopping when the end of file is reached or an- other
     machine or a default token is encountered.

 default
     This is the same as machine name except that default matches any
     name.  There can be only one default token, and it must be after all
     machine tokens.  This is normally used as:

         default login anonymous password user@site

     thereby giving the user automatic anonymous login to machines not
     specified in .netrc.

 login name
     Identify a user on the remote machine.  If this token is present, the
     auto-login process will initiate a login using the specified name.

 password string
     Supply a password.  If this token is present, the auto-login process
     will supply the specified string if the remote server requires a
     password as part of the login process.

 account string
     Supply an additional account password.  If this token is present, the
     auto-login process will supply the specified string if the remote
     server requires an additional account password.

 macdef name
     Define a macro. "Net::Netrc" only parses this field to be compatible
     with _f_t_p.

CCllaassss MMeetthhooddss The constructor for a “Net::Netrc” object is not called new as it does not really create a new object. But instead is called “lookup” as this is essentially what it does.

 "lookup($machine[, $login])"
     Lookup and return a reference to the entry for $machine. If $login is
     given then the entry returned will have the given login. If $login is
     not given then the first entry in the .netrc file for $machine 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 "undef" is returned.

OObbjjeecctt MMeetthhooddss “login()” Return the login id for the netrc entry

 "password()"
     Return the password for the netrc entry

 "account()"
     Return the account information for the netrc entry

 "lpa()"
     Return a list of login, password and account information for the
     netrc entry

EEXXPPOORRTTSS #

 _N_o_n_e.

KKNNOOWWNN BBUUGGSS #

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

SSEEEE AALLSSOO #

 Net::Cmd.

AAUUTTHHOORR #

 Graham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>.

 Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining
 libnet as of version 1.22_02.

CCOOPPYYRRIIGGHHTT #

 Copyright (C) 1995-1998 Graham Barr.  All rights reserved.

 Copyright (C) 2013-2014, 2020 Steve Hay.  All rights reserved.

LLIICCEENNCCEE #

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

VVEERRSSIIOONN #

 Version 3.14

DDAATTEE #

 23 Dec 2020

HHIISSTTOORRYY #

 See the _C_h_a_n_g_e_s file.

perl v5.36.3 2023-02-15 Net::Netrc(3p)