jepri has asked for the wisdom of the Perl Monks concerning the following question:
The meta-code looks like this:
PROPFIND { get_properties_recursive{ while properties get_property_nonrec generate_xml_chunkette loop return xml_chunks } add_xml_header_and_footer return xml_document }
There are obvious things I could do, like pass in the HTTP::Daemon object, and print each chunk as I generate it. But this breaches functional and procedural coding guidlines as I understand them. I will have duplicated server output routines, and my code will not be obvious.
A while ago I heard about something called continuations, which perl doesn't have, but they sound ideal. My current plan is to completely turn my routines inside out (ouch), and hand a code ref to HTTP::Daemon, which it will then call for each chunk of XML (functional style). This will require messy state switches and other yick. Before I do this, would anyone care to recommend a better approach?
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Turning a sub inside out
by shotgunefx (Parson) on Mar 23, 2002 at 04:30 UTC | |
by jepri (Parson) on Mar 23, 2002 at 04:37 UTC | |
by shotgunefx (Parson) on Mar 23, 2002 at 04:40 UTC |