On Thu Dec 10 08:33:45 2009, CFRANKS wrote:
Show quoted text> Because some processors do
> $callback->( $value )
> and some do
> $callback->( $value, $params )
> I'm wary of adding another positional argument, in case it gets too
> confusing.
>
> An alternative would be adding a new method to replace callback(), while
> leaving callback() working as before, but possibly deprecated.
>
> Or we could turn $params into an object that can still be accessed as a
> hashref, like now, but could also provide $self or $form via methods.
>
> I'm still undecided of the best way forward, so I'll leave this open for
> now as a reminder, and for further comment.
I've actually just created a new Callback constraint called
CallbackWithForm that will actually handle it, the changes basically
involve not passing positional arguments but passing a hash of options:
e.g. obj->callback(value => $value, params => $params, form => $self->form)
I've not yet had the chance to really dig into FormFu guts but if
there's a way that $params can be an object with a few methods to
provide $form/$self (while still being accessible as a hashref for
backward compatibility), that seems to be the "nicer" solution in a way.