Perl Casual #1 - Config Pit

download Perl Casual #1 - Config Pit

If you can't read please download the document

Transcript of Perl Casual #1 - Config Pit

Config::PitConfig::PitConfig::Pit

Config::Pit

cho45

#!/usr/bin/perluse strict;use warnings;use Data::Dumper;use Config::Pit;

my $config = Config::Pit::get("foo");

print Dumper $config;

#!/usr/bin/perluse strict;use warnings;use Data::Dumper;use Config::Pit;

my $config = Config::Pit::get("foo");

print Dumper $config;

$VAR1 = { 'id' => 'bayashi', 'pw' => 'hogefuga' };

Config::Pit

Config::Pit

ID

Config::Pit

ID

ppit

$ ppit

Usage: $ ppit [get|set|switch] $ ppit help

Options: get => Get values of . set => Config values of name with $EDITOR. switch => Switch profile to . help => show this manual

Usage: $ ppit [get|set|switch] $ ppit help

$ ppit set foo

[.bashrc]

export EDITOR=vim

--- {}

id: bayashipw: hogefuga

#!/usr/bin/perluse strict;use warnings;use Data::Dumper;use Config::Pit;

my $config = Config::Pit::get("foo");

print Dumper $config;

$VAR1 = { 'id' => 'bayashi', 'pw' => 'hogefuga' };

~/.pit/

[ .pit ] $ cat default.yaml---"foo": "id": 'bayashi' "pw": 'hogefuga'

$

WARN:

$ perl -MConfig::Pit -e 'Config::Pit::set("foo",data => { id => "bayashi", pw => "hogefuga"})'

Config::Pit

not onlyfor ID, PW

---"google_search_api": "key": 'ABQIAAAA5a...' "pubId": 'pub-32041********04'"amazon_api": "associate_id": 'foo-22' "secret_key": '9Djs...' "subscription_id": '0M6*********ZAG2'

http://perl-users.jp/articles/advent-calendar/2008/21.html

http://search.cpan.org/dist/Config-Pit/

http://perl-users.jp/modules/config_pit.html