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

I'm not sure what I'm doing wrong here, but, I can't seem to populate %config from the config file that I have created. This obviously isn't the entire program, but it represents the piece that I'm having issues with. TIA!

Here's a snippet of code and the config file data:

#!/usr/local/bin/perl -w use strict; use Data::Dumper; use Mozilla::LDAP::Conn; use Mozilla::LDAP::Utils; use Config::General; my @path = qw(/usr/lib/perl /export/home/bills/); my $rcfile = "/export/home/bills/acct.cfg"; my $conf = new Config::General(-ConfigFile => "acct.cfg", -ConfigPath +=> \@path); my %config = $conf->getall(); $conf->save_file("new"); print Dumper(\%config); exit;
The config file data:
<user jsearle> <server psdbsrv1> why lastLogin Never logged in approved exp shell email_1_date email_2_date </server> <server psdev1> why lastLogin Never logged in approved exp shell email_1_date email_2_date </server> <server psbeta1> why lastLogin Never logged in approved exp shell email_1_date email_2_date </server> <server orafinalpha1> why lastLogin Never logged in approved exp shell email_1_date email_2_date </server> </user>

Replies are listed 'Best First'.
Re: Help with Config::General
by PodMaster (Abbot) on Nov 21, 2003 at 04:49 UTC
    Hmm, works for me. So if you're not getting error messages, the only thing I see as happening is that Config::General is finding an empty file. Try printing $conf->{ConfigFile}; after you create the object to see which file it's picking up.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.