GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Config::INI(3) User Contributed Perl Documentation Config::INI(3)

Config::INI - simple .ini-file format

version 0.027

Config-INI comes with code for reading .ini files:

  my $config_hash = Config::INI::Reader->read_file('config.ini');

...and for writing ".ini" files:

  Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini');

See Config::INI::Writer and Config::INI::Reader for more examples.

This module has a long-term perl support period. That means it will not require a version of perl released fewer than five years ago.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

This section describes the format parsed and produced by Config::INI::Reader and ::Writer. It is not an exhaustive and rigorously tested formal grammar, it's just a description of this particular implementation of the not-quite-standardized "INI" format.

  ini-file   = { <section> | <empty-line> }

  empty-line = [ <space> ] <line-ending>

  section        = <section-header> { <value-assignment> | <empty-line> }

  section-header = [ <space> ] "[" <section-name> "]" [ <space> ] <line-ending>
  section-name   = string

  value-assignment = [ <space> ] <property-name> [ <space> ]
                     "="
                     [ <space> ] <value> [ <space> ]
                     <line-ending>
  property-name    = string-without-equals
  value            = string

  comment     = <space> ";" [ <string> ]
  line-ending = [ <comment> ] <EOL>

  space = ( <TAB> | " " ) *
  string-without-equals = string - "="
  string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ?

Of special note is the fact that no escaping mechanism is defined, meaning that there is no way to include an EOL or semicolon (for example) in a value, property name, or section name. If you need this, either subclass, wait for a subclass to be written for you, or find one of the many other INI-style parsers on the CPAN.

The order of sections and value assignments within a section are not significant, except that given multiple assignments to one property name within a section, only the final one is used. A section name may be used more than once; this will have the identical meaning as having all property assignments in all sections of that name in sequence.

The definitions above refer to the format used by the Reader and Writer classes bundled in the Config-INI distribution. These classes are designed for easy subclassing, so it should be easy to replace their behavior with whatever behavior your want.

Patches, feature requests, and bug reports are welcome -- but I'm more interested in making sure you can write a subclass that does what you need, and less in making Config-INI do what you want directly.

Thanks to Florian Ragwitz for improving the subclassability of Config-INI's modules, and for helping me do some of my first merging with git(7).

Originaly derived from Config::Tiny, by Adam Kennedy.

Ricardo Signes <rjbs@semiotic.systems>

  • castaway <castaway@desert-island.me.uk>
  • David Steinbrunner <dsteinbrunner@pobox.com>
  • Florian Ragwitz <rafl@debian.org>
  • George Hartzell <hartzell@alerce.com>
  • Graham Knop <haarg@haarg.org>
  • Ricardo SIGNES <com.github@rjbs.manxome.org>
  • Smylers <Smylers@stripey.com>

This software is copyright (c) 2007 by Ricardo Signes.

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

2021-06-23 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.