NAME
Config::INI::Reader::Multiline - Parser for .ini files with line continuations
SYNOPSIS
If act.ini contains:
[general]
conferences = ye2003 fpw2004 \
apw2005 fpw2005 hpw2005 ipw2005 npw2005 ye2005 \
apw2006 fpw2006 ipw2006 npw2006
cookie_name = act
searchlimit = 20
And your program does:
my $config = Config::INI::Reader::Multiline->read_file('act.ini');
Then $config contains:
{
general => {
cookie_name => 'act',
conferences => 'ye2003 fpw2004 apw2005 fpw2005 hpw2005 ipw2005 npw2005 ye2005 apw2006 fpw2006 ipw2006 npw2006',
searchlimit => '20'
}
}
DESCRIPTION
Config::INI::Reader::Multiline is a subclass of Config::INI::Reader that offers support for line continuations, i.e. adding a \<newline> (backslash-newline) at the end of a line to indicate the newline should be removed from the input stream and ignored.
In this implementation, the backslash can be followed and preceded by whitespace, which will be ignored too (just as whitespace is trimmed by Config::INI::Reader).
METHODS
All methods from Config::INI::Reader are available, and none extra.
OVERRIDEN METHODS
The following two methods from Config::INI::Reader are overriden (but still call for the parent version):
preprocess_line
Prepends the buffered lines to the current line, and lets the ancestor method deal with the result.
Note that whitespace at the end of continued lines and at the beginning of continuation lines is trimmed, and that consecutive lines are joined with a single space character.
parse_value_assignment
This method skips lines ending with a \ and leaves them to "handle_unparsed_line" for buffering.
handle_unparsed_line
This method buffers the unparsed lines that contain a \ at the end, and calls its parent class version to deal with the others.
finalize
When the last line has been read and processed, and the buffer is not empty, this means the last line had a / at the end, which is considered a syntax error.
ACKNOWLEDGEMENTS
Thanks to Vincent Pit for help (on IRC, of course!) in finding a descriptive but not too long name for this module.
Thanks to Steve Rogerson for finding out that continuations followed by an ignorable line were broken, which led to significant code simplication.
AUTHOR
Philippe Bruhat (BooK), <book@cpan.org>, who needed to read act.ini files without AppConfig.
COPYRIGHT
Copyright 2014-2026 Philippe Bruhat (BooK), all rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.