Re: Client::HTTP content filters (was Re: Looking for complex poe examples)
Mathieu Longtin wrote: > Unless you are parsing a really huge piece of XML or HTML, > I don't suggest doing it in a non-blocking manner. It is a > CPU intensive process, so you won't gain anything from > having POE wait for it instead of your own function. > Beside, for anything less than 1MB, it will probably be > fast enough to be unnoticeable to the app response time. > > That being said, if you are parsing multi-megabytes XML > documents, you may want to break the parsing in smaller > chunks to allow POE to deal with incoming network requests > and whatnot. Yes, this is the case I am dealing with. I expect message sizes to be small or very large (up to 10MB). If I use a SAX parser, I can interupt parsing and post events on a tag-by-tag basis, but when I encounter large amounts of character data, the parsing task will block everything else until another tag is found. This sounds like what wheels are for, but it doesn't look like they can handle anything but filehandles and sockets.
Re: Client::HTTP content filters (was Re: Looking for complex poe examples)
Unless you are parsing a really huge piece of XML or HTML, I don't suggest doing it in a non-blocking manner. It is a CPU intensive process, so you won't gain anything from having POE wait for it instead of your own function. Beside, for anything less than 1MB, it will probably be fast enough to be unnoticeable to the app response time. That being said, if you are parsing multi-megabytes XML documents, you may want to break the parsing in smaller chunks to allow POE to deal with incoming network requests and whatnot. --- Martijn van Beers <[EMAIL PROTECTED]> wrote: > On Thu, 2006-04-20 at 14:49 -0700, [EMAIL PROTECTED] > wrote: > > I've seen some poe snippets and modules, but I've yet > to find a > > complete, and relatively complex application that uses > many components. > > Can somebody point me to a project that shows how this > can be done. I > > suspect something like the dailystrips design > > (http://poe.perl.org/?Rocco/features_for_dailystrips) > on the wiki page > > would be perfect. I'd also really love to see how html > or xml message > > parsing can be done in a non-blocking way (doesn't look > like poco http > > can use filters). Thanks in advance. > > Hrm, yes. That's one of the things I still needed doing > before I stopped > working on Client::HTTP. You might want to try > implementing it yourself > if you desperately need it. Shouldn't be too hard I > think. Add a > parameter to Client::HTTPRequestFactory->new(), and use > that in > poco_weeble_io_read() (in HTTP.pm) instead of the > hardcoded > Filter::Stream. > > > Martijn > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Client::HTTP content filters (was Re: Looking for complex poe examples)
On Thu, 2006-04-20 at 14:49 -0700, [EMAIL PROTECTED] wrote: > I've seen some poe snippets and modules, but I've yet to find a > complete, and relatively complex application that uses many components. > Can somebody point me to a project that shows how this can be done. I > suspect something like the dailystrips design > (http://poe.perl.org/?Rocco/features_for_dailystrips) on the wiki page > would be perfect. I'd also really love to see how html or xml message > parsing can be done in a non-blocking way (doesn't look like poco http > can use filters). Thanks in advance. Hrm, yes. That's one of the things I still needed doing before I stopped working on Client::HTTP. You might want to try implementing it yourself if you desperately need it. Shouldn't be too hard I think. Add a parameter to Client::HTTPRequestFactory->new(), and use that in poco_weeble_io_read() (in HTTP.pm) instead of the hardcoded Filter::Stream. Martijn