brad clawsie > Text-Authinfo-0.03 > Text::Authinfo

Download:
Text-Authinfo-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Text::Authinfo - read, query and write authinfo files

VERSION ^

Version 0.01

STATUS ^

This package should be considered new and untested. Please use at your own risk.

CAVEATS ^

Users should note that authinfo files are without a formal specification. I have referred to resources that claim authority, particularly

http://www.gnu.org/software/emacs/manual/html_node/gnus/NNTP.html

(see "nntp-authinfo-function")

It should be noted that this library supports a subset of files as described here, not arbitrary key/value pairs as hinted at in the description provided by gnu.org.

SYNOPSIS ^

  use Text::Authinfo;

  my $a = Text::Authinfo->new();
  my $read_success = $a->readauthinfo();
  print $a->as_string();
  my $pw = $a->getauth('machine.example.com','me@example.com','9999');
  my $write_success = $a->writeauthinfo();

PACKAGE VARIABLES ^

$authinfofile - the full path of the authinfo file used by default, which points to ~/.authinfo.

OBJECT VARIABLES ^

FILE - the full filename path for the authinfo file

AUTHINFO - the nested hashrefs denoting the authinfo data. This is of the form:

  $a->{AUTHINFO}->{$machine}->{$port}->{$login} = $password;

SUBROUTINES/METHODS ^

new

  my $a1 = Text::Authinfo->new();
  my $a2 = Text::Authinfo->new('/home/me/.otherauthinfofile');

The constructor has an optional argument that can be used to stipulate an alternative authinfofile to use.

readauthinfo

  my $read_success = $a->readauthinfo();

Reads the authinfofile data into $a->{AUTHINFO}. Returns 1 for success, 0 otherwise.

as_string

  print $a->as_string();

writeauthinfo

  my $write_success1 = $a1->writeauthinfo();
  my $write_success2 = $a2->writeauthinfo({'nobackup'=>1});

Writes the contents of $a->{AUTHINFO} into $a->{FILE}, while creating a backup file with the same path as $a->{FILE}, but with '.bak' appended.

Passing a hashref with nobackup set will prevent this behavior.

Note! this function will overwrite your existing authinfo file. This can be dangerous! Keep backups.

The file written will have mode 0600 applied.

getauth

  my $pw = $a->getauth('machine.example.com','me@example.com','9999');

  my $pw = $a->getauth('machine.example.com','me@example.com');

This function retrieves your password. The required arguments are determined by the contents of the line for each auth. If a port was mandated, you must pass that in as the third parameter as in the first example above. Otherwise, if the auth line in question did not contain a port, do not pass one in here.

This function returns undef if no match is found.

AUTHOR ^

brad clawsie, <bclawsie at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-file-authinfo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-Authinfo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Text::Authinfo

You can also look for information at:

CONTRIBUTING ^

See the public git repository at:

https://github.com/xylabs/perl-Text-Authinfo

LICENSE AND COPYRIGHT ^

Copyright 2011 brad clawsie.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: