The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Config::Pit - Manage settings


  use Config::Pit;

  my $config = pit_get("", 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}


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
  # open setting of with $EDITOR.

And Config::Pit provides ppit command which is pit command written in Perl.


  $ ppit help


Config::Pit::get(setting_name, opts)

Get setting named setting_name from current profile.

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

This is same as below:

  my $config = pit_get("");



Specify fields you want as key and hint (description or default value) of the field as value.

  my $config = pit_get("", require => {
    "username" => "your username on",
    "password" => "your password on"

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(""); #=> will open setting with $EDITOR


  Config::Pit::set("", data => {
    username => "foobar",
    password => "barbaz",

When data specified, will not open $EDITOR and set the data directly.

  Config::Pit::set("", config => {
    username => "config description or default value",
    password => "same as above",

Open $EDITOR with merged setting with specified config.


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...


cho45 <>


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO is pit in Ruby.

bin/ppit is pit command in Perl.