On Mar 14, 2007, at 9:23 AM, RA Jones wrote:
Hi folks,
Using Cat::Controller::Formbuilder. The background is I have 2
methods that essentially do the same thing to start with, ie my
$form = $self->formbuilder, which populates the fields from the
information in an .fb file. But I need to override some of the
field definitions, so I list them separately as a series of $form-
>field( name => 'name', option => [EMAIL PROTECTED] ).
Because this is repeated in both of the methods I thought I could/
should factor out the common code to a private sub like this:
$self->_override_field_defs($form);
but it doesn't work. The only way so far to do it is to put $form
in the stash and use $c->forward('_override_field_defs'), then
retrieve $form from the stash in _override_field_defs().
Is this the correct way to call sub-routines, via $c->forward and
$c->stash? I know about TIMTOWTDI but I want to start off with
'best practice'.
You can forward $c, which will let you call the form object directly.
Adam
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/