Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

config::ini(3pm) [debian man page]

Config::INI(3pm)					User Contributed Perl Documentation					  Config::INI(3pm)

NAME
Config::INI - simple .ini-file format VERSION
version 0.019 SYNOPSIS
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. GRAMMAR
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. DON'T FORGET 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 requets, 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
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). ORIGIN
Originaly derived from Config::Tiny, by Adam Kennedy. AUTHOR
Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
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. perl v5.14.2 2011-12-15 Config::INI(3pm)

Check Out this Related Man Page

inifile(n)						   Parsing of Windows INI files 						inifile(n)

__________________________________________________________________________________________________________________________________________________

NAME
inifile - Parsing of Windows INI files SYNOPSIS
package require Tcl 8.2 package require inifile ?0.2.3? ::ini::open file ?access? ::ini::close ini ::ini::commit ini ::ini::revert ini ::ini::filename ini ::ini::sections ini ::ini::keys ini section ::ini::get ini section ::ini::exists ini section ?key? ::ini::value ini section key ?default? ::ini::set ini section key value ::ini::delete ini section ?key? ::ini::comment ini section ?key? ?text? ::ini::commentchar ?char? _________________________________________________________________ DESCRIPTION
This package provides an interface for easy manipulation of Windows INI files. ::ini::open file ?access? Opens an INI file and returns a handle that is used by other commands. access is the same as the first form (non POSIX) of the open command, with the exception that mode a is not supported. The default mode is r+. ::ini::close ini Close the specified handle. If any changes were made and not written by commit they are lost. ::ini::commit ini Writes the file and all changes to disk. The sections are written in arbitrary order. The keys in a section are written in alphabet- ical order. If the ini was opened in read only mode an error will be thrown. ::ini::revert ini Rolls all changes made to the inifile object back to the last committed state. ::ini::filename ini Returns the name of the file the ini object is associated with. ::ini::sections ini Returns a list of all the names of the existing sections in the file handle specified. ::ini::keys ini section Returns a list of all they key names in the section and file specified. ::ini::get ini section Returns a list of key value pairs that exist in the section and file specified. ::ini::exists ini section ?key? Returns a boolean value indicating the existance of the specified section as a whole or the specified key within that section. ::ini::value ini section key ?default? Returns the value of the named key and section. If specified, the default value will be returned if the key does not exist. If the key does not exist and no default is specified an error will be thrown. ::ini::set ini section key value Sets the value of the key in the specified section. If the section does not exist then a new one is created. ::ini::delete ini section ?key? Removes the key or the entire section and all its keys. A section is not automatically deleted when it has no remaining keys. ::ini::comment ini section ?key? ?text? Reads and modifies comments for sections and keys. To write a section comment use an empty string for the key. To remove all com- ments use an empty string for text. text may consist of a list of lines or one single line. Any embedded newlines in text are prop- erly handled. Comments may be written to nonexistant sections or keys and will not return an error. Reading a comment from a nonex- istant section or key will return an empty string. ::ini::commentchar ?char? Reads and sets the comment character. Lines that begin with this character are treated as comments. When comments are written out each line is preceded by this character. The default is ;. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category inifile of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. CATEGORY
Text processing inifile 0.2.3 inifile(n)
Man Page