Config:...ltiline(3)

πŸ“¦
version 1.002 Β· 2 versions
, in fedora 43, fedora 44

πŸŽ€ Config::INI::Reader::Multiline(3) β€” the bestie cut πŸŽ€

okay so this is one of those User Contributed Perl Documentation pages, and today's main character is Config::INI::Reader::Multiline β€” a parser for .ini files with line continuations. Sit down, hydrate, let's get into it. πŸ’–


✨ NAME ✨

Config::INI::Reader::Multiline β€” Parser for .ini files with line continuations. That's the whole name, that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

Okay so picture this: your act.ini looks like this πŸ‘‡

[general]
conferences = ye2003 fpw2004 \
              apw2005 fpw2005 hpw2005 ipw2005 npw2005 ye2005 \
              apw2006 fpw2006 ipw2006 npw2006
cookie_name = act
searchlimit = 20

And your program does the thing:

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'
    }
}

the way that those backslash-newlines just vanished and became one long string? iconic. no cap. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

Config::INI::Reader::Multiline is a subclass of Config::INI::Reader that offers support for line continuations β€” meaning you can slap a "\<newline>" (that's a backslash-newline, bestie) at the end of a line to say "hey, remove this newline from the input stream and ignore it". πŸ”₯

In this implementation, the backslash can be followed and preceded by whitespace, and that whitespace gets ignored too β€” which is exactly the same energy as how whitespace is trimmed by Config::INI::Reader. so it's consistent, we love that for us 🫢


🧚 METHODS 🧚

All methods from Config::INI::Reader are available, and none extra. that's it. that's the section. short and sweet, periodt. ⭐


πŸ‘‘ OVERRIDEN METHODS πŸ‘‘

The following two methods from Config::INI::Reader are overriden (but still call for the parent version):

bestie I'm just telling you what the page says, okay? πŸ™ˆ

πŸ’« 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. one space. not two. not zero. πŸ’…

πŸ’« parse_value_assignment

This method skips lines ending with a "\" and leaves them to "handle_unparsed_line" for buffering. go girl, hand it off πŸŽ€

πŸ’« 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. division of labour, we stan. ✨

πŸ’« 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. 🚨

ngl bestie, if you hit this one, something's off with your file. the parser said no. 😭

🌈 ACKNOWLEDGEMENTS 🌈

Thanks to Vincent Pit for help (on IRC, of course!) in finding a descriptive but not too long name for this module. naming is hard, the group chat came through. πŸ’€

Thanks to Steve Rogerson for finding out that continuations followed by an ignorable line were broken, which led to significant code simplication. bug found, code simplified, slay. πŸ›βž‘οΈβœ¨


πŸ’– AUTHOR πŸ’–

Philippe Bruhat (BooK), <book@cpan.org>, who needed to read act.ini files without AppConfig. relatable honestly. πŸ™ˆ


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


and that's the whole page, bestie!! this was perl v5.42.0 documentation, dated 2026-01-26 β€” so if you're reading this from the future, hi, hope you're hydrated. πŸ’–βœ¨πŸŽ€πŸ¦‹ bye!!

πŸ“¦ where this page comes from