[Catalyst] Calling a private sub - best practice
RA Jones
ra.jones at dpw.clara.co.uk
Wed Mar 14 16:23:21 GMT 2007
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
=> \@options ).
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'.
--
Richard Jones
Leeds, UK
mailto:ra.jones at dpw.clara.co.uk
More information about the Catalyst
mailing list