I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-12-13 13:43:47-08 by jdhedden in response to 3752
Re: OIO and default value
Defaults are specified in 3 places: The :InitArgs hash, the :Args attribute and the :Default attribute. They all need to work consistent with each other. Because :InitArgs are 'compiled', they can not be 'eval'ed at assignment time.
my %init_args :InitArgs = ( 'cref' => { 'field' => \@cref, 'default' => sub { return 'foo' }, }, );
In the above, because the default is a code ref, you cannot do a string eval on it.

Additionally, defaults are currently 'static' data. Implementing some sort of eval mechanism to get dynamic defaults would cause incompatibilities.

Therefore, you'll need to contend with preprocessing to do what you want. That's one of the reasons it was provided.
Direct Responses: Write a response