2008/11/18 Ronald J Kimball <[EMAIL PROTECTED]>: > I'm using FormFu in an application that gets a fair amount of traffic, and > creates the same forms over and over again. > > I had the idea to cache the FormFu objects in memcached, rather than create > them from scratch every time. This works as long as the cached object is > retrieved in the same process. However, if the object is retrieved in > another process, then some of the HTML::FormFu modules may not have been > loaded, leading to errors such as the following: > > [error] Couldn't render template "undef error - Can't locate object method > "process" via package "HTML::FormFu::Deflator::CompoundSplit" at > /home/rkimball/svn/pangea/trunk/site_perl/HTML/FormFu/Element/_Field.pm line > 625. > " > > I know that this is not specifically a memcached/HTML::FormFu issue, but > rather a general issue with serializing objects. I'm not sure what a > general solution would be, however, especially because package names don't > necessarily correspond directly to module files. So I'm wondering if anyone > else has tried caching FormFu objects, if they encountered this problem, and > how they dealt with it in this specific case.
Hi Ronald, If you add a "use HTML::FormFu::Preload;" somewhere, it'll load up all elements, constraints, plugins, etc - which will solve this problem at the cost of a higher memory usage. The other option would be to manually add "use" statements for all elements, etc. that you need - you'll just need to remember to keep it updated. It might make sense for the caching to be added to Catalyst-Controller-HTML-FormFu, so it can be cached/retrieved before the catalyst context is added to the form stash - otherwise you'll have problems. Carl _______________________________________________ HTML-FormFu mailing list [email protected] http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
