in reply to best way to store login information for a perl script?
Synchronicity. I just wrote this idea into some code an hour ago for a stock account package. I used the idiom from mysql. A config file in the user's home. So, something like-
use YAML (); my $config = YAML::LoadFile("$ENV{HOME}/.twitter.cnf"); # Where the file in question is only readable by the user- cow@moo[1607]~>sl .twitter.cnf -rw------- 1 cow staff 0 Jul 3 23:08 .twitter.cnf # And the config file looks like (YAML) this- --- username: MooseQueen password: twitterLuser
Then, presumably, all together-
use Net::Twitter; use YAML (); my $config = YAML::LoadFile("$ENV{HOME}/.twitter.cnf"); my $twit = Net::Twitter->new( traits => [qw/API::REST/], %{$config}, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: best way to store login information for a perl script?
by JavaFan (Canon) on Jul 04, 2009 at 12:24 UTC | |
by graff (Chancellor) on Jul 04, 2009 at 15:05 UTC | |
by Your Mother (Archbishop) on Jul 04, 2009 at 16:00 UTC | |
by JavaFan (Canon) on Jul 05, 2009 at 23:42 UTC |