I'm trying to get Config::Std working on a server for some cgi stuff..

(Not sure where to look for more info on this)

It works great on my workstation(FC kernel 2.6)and on one server (Suse kernel 2.6) - and then.. i have these two other boxes with FreeBSD (no root access to these guys), and i'm having the thing poop out.. I wonder if it's the architectures and not something else???

Test code follows..

my $conf = load_conf(); sub load_conf { my $arg= shift; $arg->{filename} ||= 'site.conf'; unless( -f cwd."/$$arg{filename}" ){ open(CONF, ">".cwd."/$$arg{filename}") or die($!); print CONF define_default_conf(); close CONF; } read_config( "$$arg{filename}" => my %conf); # line 317 return \%conf; } sub define_default_conf { my $defaultconf = <<"DEFAULTCONF"; # config file for site [Paths] # relative to cgi content_dir: $ENV{DOCUMENT_ROOT}/content thumbnails_dir: $ENV{DOCUMENT_ROOT}/.thumbnails metadata_dir: $ENV{DOCUMENT_ROOT}/.metadata templates_dir: $ENV{DOCUMENT_ROOT}/templates [Settings] main_template_filename: template.html request_param: section DEFAULTCONF return $defaultconf; }

I get this error:

Malformed prototype for Config::Std::Hash::read_config: $\%$ at index.cgi line 317.
The file does not get created also- .

Same damn code works perfect on the suse and fedora boxes. Also tried having the files already there (instead of creating defaults.. but same error. I'm so sad.. Config::Std made by *the* DC)

Does anything here look familiar to you?

update Sept 06 2006

Config::Std is nice, but I've had some problems using it in the real world accross different hosting accounts. The reality is that hosts do not maintain their perl and other modules up to date. And we do not always have the choice of where our software runs.

I sadly switched to using CGI::Ex::Conf with YAML which does do the job, and well.

This is sad because Config::Std was made by Damian Conway, who also made Smart::Comments, and wrote Perl Best Practices. ( wow )


In reply to problem with Config::Std on FreeBSD box? by leocharre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.