Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
package Config::Simple; # $Id: Simple.pm,v 3.50 2003/04/29 01:42:25 sherzodr Exp $ use strict; # uncomment the following line while debugging. Otherwise, # it's too slow for production environment #use diagnostics; use Carp; use Fcntl qw(:DEFAULT :flock); use Text::ParseWords 'parse_line'; use vars qw($VERSION $DEFAULTNS $LC $USEQQ $errstr); use AutoLoader 'AUTOLOAD'; $VERSION = '4.55'; $DEFAULTNS = 'default';
I'm confused as to the ver num, it seems to be 3.50 and 4.55 ???
My code is this:
#!/usr/bin/perl -w + use Config::Simple; use strict; + + my $cfg; my %config; $cfg = new Config::Simple('test.cfg'); open(FH,"test.cfg"); printf("'%s' syntax\n", $cfg->guess_syntax(\*FH)); close FH; %config = $cfg->vars(); print "NET = $config{NET} \n"; exit;
and my cfg file is a 1 liner (for test purposes):
NET = X
The output is:
'ini' syntax Use of uninitialized value in concatenation (.) or string at ./t2.pl l +ine 14. NET =
which is odd because it should be 'simple' syntax according to the CPAN page http://search.cpan.org/~sherzodr/Config-Simple-4.55/Simple.pm
More importantly, it doesn't return the cfg file value.
I've had a look through google and here (perlmonks) but can't find the problem mentioned. Maybe it's just me....
Any help appreciated.
I'd really like to use the hash syntax, because it's simpler/less 'noisy' than the other options.
Cheers
Chris
PS Supplementary dumb qn: why do i have to use HTML tags writing my qn. Why won't it accept CR/LF chars as in normal text?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Config::Simple with vars method
by davidj (Priest) on Jul 06, 2004 at 04:55 UTC | |
by Anonymous Monk on Jul 06, 2004 at 05:06 UTC | |
by davidj (Priest) on Jul 06, 2004 at 05:16 UTC | |
|
Re: Config::Simple with vars method
by matija (Priest) on Jul 06, 2004 at 07:02 UTC |