Jason Gottshall wrote:
John Siracusa wrote:
On Mon, Jan 26, 2009 at 1:43 PM, Jason Gottshall
<jgottsh...@capwiz.com> wrote:
Caching sounds wise. The only kink I see is that my controller allows
for
multiple instances of the same form.
The "same form" meaning what? If you store forms keyed by an
arbitrary name string, you can have as many forms as you want so long
as the names are unique.
My implementation is designed to instantiate subclasses of
Rose::HTML::Form based on the class name, which would likely also be the
cache key, hence the difficulty in having multiple instances of the same
form.
Honestly, the only use case I can actually envision for having the same
form on a page more than once is maybe displaying a simple search form
both above and below a set of results, and even then you wouldn't
actually need two instances of the class, you'd just need to render the
same object twice. Unless anyone can see a use case I'm missing, I think
the point is moot, and I will just remove that whole "same form twice"
concept from the module and be done with it.
I've been thinking some more about the caching issue, and I'm concerned
about the fact that rose form objects are mutable beyond just setting
values for the fields. Any code that works with a form object can
add/delete fields and subforms, monkey with validation routines, etc.
Unless I can reset a form object to it's "new()-like" state before I
reuse it, it seems like I really need a whole new instance to work with
on each request. I haven't benchmarked yet; is there really that much
overhead in constructing these form objects?
--
Jason Gottshall
jgottsh...@capwiz.com
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/