|
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
|