Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Config::General issue with conf file

by chexmix (Hermit)
on Jan 03, 2018 at 16:07 UTC ( #1206606=perlquestion: print w/replies, xml ) Need Help??
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
    From https://www.xmlvalidation.com/:

    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 (Monsignor) 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>
    poj
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;>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1206606]
Approved by marto
help
Chatterbox?
and the daffodils sway...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-02-25 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (314 votes). Check out past polls.

    Notices?