Help needed with AppConfig

F

Fred

If I run the code snippet below using the AppConfig
module, I receive the error:

user: no such variable
Use of uninitialized value in print at ./appconfig.pl line 22.

I've included the app.cfg configuration file that I'm reading
with AppConfig. I read the docs, but don't see what I'm
doing wrong. Any ideas?

-Thanks


appconfig.pl
#!/usr/bin/perl -w

use strict;

use AppConfig qw:)expand);

my $cfgfile = '/home/fred/app.cfg';
my $config = AppConfig->new($cfgfile);
print $config->user();



/home/fred/app.cfg:

user = fred
home = /home/fred
 
A

A. Sinan Unur

If I run the code snippet below using the AppConfig
module, I receive the error:

user: no such variable
Use of uninitialized value in print at ./appconfig.pl line 22.

I've included the app.cfg configuration file that I'm reading
with AppConfig. I read the docs, but don't see what I'm
doing wrong. Any ideas?

I have never used AppConfig, but it looks like you need to specify the
variables you expect to read from the config file in the call to new:

<URL:http://search.cpan.org/src/ABW/AppConfig-1.56/t/file.t>

Sinan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,503
Latest member
supremedee

Latest Threads

Top