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

NAME

Config::Lite - Load config from file to hash.

SYNOPSIS

Once you make a config file like this:

  # /etc/myconfig.conf
  test1=123
  test2=abc
  right=left
  pop = bad  [
  so =gogogo
  lover = yejiao       
  #sharped=somevalue

You can code like this:

  use Config::Lite qw(load_config);
  my %config = load_config("/etc/myconfig.conf");

You got this:

  # %config = (
  #   "test1" => 123,
  #   "test2" => "abc",
  #   "right" => "left",
  #   "pop" => "bad  [",
  #   "so" => "gogogo",
  #   "lover" => "yejiao",
  # );

DESCRIPTION

Simple config load module.

Clean and no dependence.

Easy to use and install.

flock inside.

METHODS

set_config_separator($type, $string)

Optional.

User set separator. Always return 1.

use set_config_separator("kv", "your_separator") set separator between key and value.

use set_config_separator("line", "your_separator") set separator between lines.

use set_config_separator("comment", "your_separator") set separator before a comment line.

load_config($filename)

Main method.

Read config file into a hash then return it.

EXPORT

None by default.

SEE ALSO

Config::Auto, Config::General

AUTHOR

Chen Gang, <yikuyiku.com@gmail.com>

http://blog.yikuyiku.com/

COPYRIGHT AND LICENSE

Copyright (C) 2013 by Chen Gang

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