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 2005-12-28 19:34:43-08 by earl
How do you suggest creating derived fields?

Suppose I am creating a class with a birthyear and age field. I use the birthyear field to calculate the value of the age field. Here is my initial arguments.

my %init_args :InitArgs = ('birthyear' => { 'Field' => \@birthyear_of } );

Since the age field initialization is non-trivial, I have to initialize age field within an":init" subroutine. Within the ":init" subroutine, I was having trouble finding the value of the birthyear. Object::InsideOut has removed the value of the birthyear from the hash. (IMHO, this is because that value was already used to initialize birth field). And I may not get it from the field, because it doesn't look like all the initialized fields are set before Perl calls the ":init" subroutine.

I'm thinking that I can remove the 'Field' attribute from %init_args, and do the birthyear initialization manually. However, if all the implicitly initialized fields were set before calling the :init subroutine, I could still do birthyear automatically.
Direct Responses: 1528 | Write a response