-
-
13 Jan 2010 15:56:51 UTC
- Distribution: Config-Pit
- Module version: 0.04
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (1677 / 98 / 2)
- Kwalitee
Bus factor: 1- 38.59% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (41.1KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- File::HomeDir
- File::Spec
- File::Temp
- Filter::Util::Call
- List::MoreUtils
- Path::Class
- YAML::Syck
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Config::Pit - Manage settings
SYNOPSIS
use Config::Pit; my $config = pit_get("example.com", require => { "username" => "your username on example", "password" => "your password on example" }); # if the fields are not set, open setting by $EDITOR # with YAML-dumped default values (specified at C<require>). # use $config->{username}, $config->{password}
DESCRIPTION
Config::Pit is account setting management library. This library automates editing settings used in scripts.
Original library is written in Ruby and published as pit gem with management command.
You can install it by rubygems:
$ sudo gem install pit $ pit set example.com # open setting of example.com with $EDITOR.
And Config::Pit provides ppit command which is pit command written in Perl.
See:
$ ppit help
FUNCTIONS
Config::Pit::get(setting_name, opts)
Get setting named
setting_name
from current profile.my $config = Config::Pit::get("example.com");
This is same as below:
my $config = pit_get("example.com");
opts:
- require
-
Specify fields you want as key and hint (description or default value) of the field as value.
my $config = pit_get("example.com", require => { "username" => "your username on example.com", "password" => "your password on example.com" });
require
specified, module check the required fields all exist in setting. If not exist, open the setting by $EDITOR with merged setting with current setting.
Config::Pit::set(setting_name, opts)
Set setting named
setting_name
to current profile.Config::Pit::set("example.com"); #=> will open setting with $EDITOR
opts:
- data
-
Config::Pit::set("example.com", data => { username => "foobar", password => "barbaz", });
When
data
specified, will not open$EDITOR
and set the data directly. - config
-
Config::Pit::set("example.com", config => { username => "config description or default value", password => "same as above", });
Open
$EDITOR
with merged setting with specified config.
Config::Pit::switch(profile_name);
Switch profile to
profile_name
.Profile is setting set:
$ pit get foobar # foo bar... $ pit switch devel Switch profile to devel $ pit get foobar # bar baz $ pit switch Switch profile to default $ pit get foobar # foo bar...
AUTHOR
cho45 <cho45@lowreal.net>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
http://lowreal.rubyforge.org/pit/ is pit in Ruby.
bin/ppit is pit command in Perl.
Module Install Instructions
To install Config::Pit, copy and paste the appropriate command in to your terminal.
cpanm Config::Pit
perl -MCPAN -e shell install Config::Pit
For more information on module installation, please visit the detailed CPAN module installation guide.