Multithreaded form building?

23 views
Skip to first unread message

Eric W

unread,
Oct 12, 2012, 11:38:43 AM10/12/12
to formh...@googlegroups.com
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.

-Eric

Gerda Shank

unread,
Oct 14, 2012, 3:21:52 PM10/14/12
to formh...@googlegroups.com
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.

Gerda

Eric Wright

unread,
Oct 15, 2012, 9:03:57 AM10/15/12
to formh...@googlegroups.com
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!

Best,
Eric



--
You received this message because you are subscribed to the Google Groups "formhandler" group.
To post to this group, send email to formh...@googlegroups.com.
To unsubscribe from this group, send email to formhandler...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/formhandler?hl=en.


Reply all
Reply to author
Forward
0 new messages