chexmix has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Monks, and Happy New Year!

I am troubleshooting a script for a colleague. The script creates news items for the "news" space of a website. When he and I run it, we get the following error:

Config::General: Block "<rightbar>" has no EndBlock statement (level: +2, chunk 244)!
This error message is followed by a reference to the line in the script that pulls in the configuration file. That line looks like this:
my $conf = new Config::General(-ConfigFile => './cda/build_pages.conf' +, -InterPolateVars => 1, -UseApacheInclude => 1, -IncludeRelative => 1);
The curiosity is that when I examine the configuration file referenced, it has the following lines at the end:
<rightbar> <status> includefile = $baseurl/incl/LeftBar/status.html </status> <<include news.conf>> </rightbar>
... and I initiate head-scratching, because the <rightbar> block certainly looks properly closed to me. What could I be missing? I have Googled this problem, and other folks' issues definitely seemed to be improperly closed blocks. But here ...?

My only thought was perhaps upgrading the module. Our version is ~2015. But that seems like a "well, I don't know what else to do" move.

Thanks, Glenn

Replies are listed 'Best First'.
Re: Config::General issue with conf file
by NetWallah (Canon) on Jan 03, 2018 at 16:47 UTC

    An error has been found!
    Click on to jump to the error. In the document, you can point at with your mouse to see the error message.
    Errors in the XML document:
    	5:	4	The content of elements must consist of well-formed character data or markup.
    XML document:
    1	<rightbar>
    2	  <status>
    3	     includefile = $baseurl/incl/LeftBar/status.html
    4	  </status>
    5	  <
    <include news.conf>>
    6	</rightbar>

                    We're living in a golden age. All you need is gold. -- D.W. Robertson.

Re: Config::General issue with conf file
by poj (Abbot) on Jan 03, 2018 at 17:40 UTC

    Running this SSCCE I got the same error but removing the -UseApacheInclude=>1 fixed it. No idea why as docs suggest it should accept either format. HTH.

    #!perl use strict; use Config::General; printf "Module Version %s\n",$Config::General::VERSION; my $conf = new Config::General(-ConfigFile => \*DATA, -InterPolateVars => 1, #-UseApacheInclude => 1, -IncludeRelative => 1 ); print $conf->save_string(); #news.conf #<news> #Some text #</news> __DATA__ <rightbar> baseurl = baseurl <status> includefile = $baseurl/incl/LeftBar/status.html </status> <<include news.conf>> </rightbar>
Re: Config::General issue with conf file
by dasgar (Priest) on Jan 03, 2018 at 16:36 UTC

    I'm not familiar with that module, which means I'm not sure what the expected format it is expecting for the input file. From the data that you posted, it kind of looks like XML type of formatting. If so, the line right before </rightbar> does not look correct. Just a guess, but maybe changing <<include news.conf>> to <include news.conf> might fix your problem.

Re: Config::General issue with conf file
by Anonymous Monk on Jan 03, 2018 at 22:49 UTC

    It looks like the following line is not correctly formed xml

    <<include news.conf>>

    You probably need to either remove one pair of angle brackets or replace the inner ones with their corresponding XML entities

    <include news.conf> <&lt;include news.conf&gt;>