• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Perl Casual #1 - Config Pit
 

Perl Casual #1 - Config Pit

on

  • 1,396 views

Config::Pit いいぉ

Config::Pit いいぉ

Statistics

Views

Total Views
1,396
Views on SlideShare
1,395
Embed Views
1

Actions

Likes
0
Downloads
3
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Perl Casual #1 - Config Pit Perl Casual #1 - Config Pit Presentation Transcript

    • Config::Pit Config::Pit Config::Pit
    • Config::Pit cho45 さん作
    • #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Config::Pit; my $config = Config::Pit::get( "foo" ); print Dumper $config ;
    • #!/usr/bin/perl use 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] <value> $ ppit help Options: get <name> => Get values of <name>. set <name> => Config values of name with $EDITOR. switch <profile> => Switch profile to <profile>. help => show this manual
    • Usage: $ ppit [get|set|switch] <value> $ ppit help
    • $ ppit set foo
    • [.bashrc] export EDITOR=vim
    • --- {}
    • id: bayashi pw: hogefuga
    • #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Config::Pit; my $config = Config::Pit::get( &quot;foo&quot; ); print Dumper $config ; $VAR1 = { 'id' => 'bayashi', 'pw' => 'hogefuga' };
    • ~/.pit/
    • [ .pit ] $ cat default.yaml --- &quot;foo&quot;: &quot;id&quot;: 'bayashi' &quot;pw&quot;: 'hogefuga' $
    • WARN: 生
    • $ perl -MConfig::Pit -e 'Config::Pit::set( &quot;foo&quot;, data => { id => &quot;bayashi&quot;, pw => &quot;hogefuga&quot; })'
    • Config::Pit
    • not only for ID, PW
    • --- &quot; google_search_api &quot;: &quot;key&quot;: 'ABQIAAAA5a...' &quot;pubId&quot;: 'pub-32041********04' &quot; amazon_api &quot;: &quot;associate_id&quot;: 'foo-22' &quot;secret_key&quot;: '9Djs...' &quot;subscription_id&quot;: '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
    • ご清聴 ありがとうございます。