Multithreaded form building?

Skip to first unread message

Eric W

Oct 12, 2012, 11:38:43 AM10/12/12
I've been working with HFH over the past several months and am pleased with its design. Hats off to the developer Gerda and thank you for providing this library to the Perl community. It was obviously a lot of work. 

I'm curious if any thought has been given to supporting multiple threads in the construction of a form. My particular use case involves the need to hit a series of REST services to construct and populate controls within the form - selects, checkboxes, etc. I would love to spin off threads to each service simultaneously rather than run these in succession due to I/O blocking. Any ideas on how best to do that? I currently have my form defined as an object and utilize the options_ callback but those are invoked synchronously. Would an asynchronous build require that I create my field definitions dynamically with threads and then pass the field definitions via the field_list parameter? That's the only approach I can think of at the moment. 

Thanks in advance for any insights.


Gerda Shank

Oct 14, 2012, 3:21:52 PM10/14/12
I think the best solution would depend on what is static/known and what
needs to be changed based on the information you get back from services.

Do you know ahead of time what the possible fields are? If you do, then
defining the fields and activating/inactivating them make sense. You can
also set the options by updating the fields at process time.

I would probably start by creating the form, kick off the async jobs,
setting the options/active fields as the information comes in, then when
all jobs are completed, run process and display the form. Or you could
just collect the information needed to construct a 'correct' form and
create it when all information is in.


Eric Wright

Oct 15, 2012, 9:03:57 AM10/15/12
Hi Gerda,

Thanks for your thoughts. That makes perfect sense. It wasn't obvious to me at first that I could update the options at process time. That's exactly what I need!


You received this message because you are subscribed to the Google Groups "formhandler" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply all
Reply to author
0 new messages