|There's more than one way to do things|
Dynamically Creating a Code referenceby Herkum (Parson)
|on Jun 15, 2006 at 21:30 UTC||Need Help??|
Herkum has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to dynamically build a Data::FormValidator profile. A short profile would look like this,
However, I want take a string and make it into closure in my profile. I am missing something however. If I do this,
Update: Made the $code not interpolate.
Update No 2: The code above is not working, in that the DFV object is not being returned first to @_.
This will dump the DFV object from @_. It seems the eval does not get the whole @_ for some reason. I don't understand why
Update No 3: OK, I found the answer and it had nothing to do with eval, which was working but rather with the validation. There is also a field_filter option used, it does not pass the DFV object, I assumed that it did, I would alter the field value, which screwed up the validation and the constraint code was not run, which is where I thought I was having problems.
Thanks for the help