Click here to get back home

AppConfig failure with ARGCOUNT_LIST

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
AppConfig failure with ARGCOUNT_LIST margin 05-22-2007
Posted by margin on May 22, 2007, 10:33 am
Please log in for more thread options


All,

I'm back to Perl after some time away. I'm attempting to use AppConfig
to read in a conf file that contains a list of attributes. I'm have
an action setup and each value is being read. For some reason only the
last entry, "version", is being set.

message.conf
[MESSAGE]
ATTRIBUTE=transactionId
ATTRIBUTE=sessionId
ATTRIBUTE=version


my $config = AppConfig->new();
$config->define(
MESSAGE_ATTRIBUTE =>
{ARGCOUNT => ARGCOUNT_LIST,
ACTION => \&validate,
}
);

When I dump the config contents I see this:

'ARGCOUNT' => HASH(0x19d65d0)
'message_attribute' => 'ARGCOUNT_LIST'
...
'PEDANTIC' => 0
'VALIDATE' => HASH(0x19d6600)
empty hash
'VARIABLE' => HASH(0x19c5f14)
'message_attribute' => 'version'

Any thoughts?

Thanks,
Bill S.


Posted by Christian Winter on May 24, 2007, 5:50 am
Please log in for more thread options


margin wrote:
> I'm back to Perl after some time away. I'm attempting to use AppConfig
> to read in a conf file that contains a list of attributes. I'm have
> an action setup and each value is being read. For some reason only the
> last entry, "version", is being set.
>
> message.conf
> [MESSAGE]
> ATTRIBUTE=transactionId
> ATTRIBUTE=sessionId
> ATTRIBUTE=version
>
>
> my $config = AppConfig->new();
> $config->define(
> MESSAGE_ATTRIBUTE =>
> {ARGCOUNT => ARGCOUNT_LIST,
> ACTION => \&validate,
> }
> );
>
> When I dump the config contents I see this:
>
> 'ARGCOUNT' => HASH(0x19d65d0)
> 'message_attribute' => 'ARGCOUNT_LIST'
> ...
> 'PEDANTIC' => 0
> 'VALIDATE' => HASH(0x19d6600)
> empty hash
> 'VARIABLE' => HASH(0x19c5f14)
> 'message_attribute' => 'version'
>
> Any thoughts?

You forgot to import the ARGCOUNT constants (that's why
ARGCOUNT_LIST gets parsed as a string instead of the integer
value of the constant).

use AppConfig qw(:argcount);
should do the trick.

-Chris

Similar ThreadsPosted
AppConfig September 17, 2006, 11:37 am
AppConfig: how to reset object? October 1, 2004, 9:20 am
Module install problem - AppConfig October 19, 2005, 2:04 pm
RFC: Bridge AppConfig and Config::Model November 22, 2007, 7:33 am
AppConfig loading undef values into ARGCOUNT_LIST March 22, 2007, 2:54 pm
GD make test failure January 16, 2005, 5:11 pm
lookfor failure in SerialPort November 30, 2005, 4:56 pm
Sudo.pm test failure April 4, 2008, 2:37 pm
Crypt::SSLeay Installation Failure January 28, 2006, 1:07 am
math::pari on solaris 9 make failure December 8, 2004, 6:36 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap