Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Realtime get with LWP or Mechanize

by lorn (Monk)
on Jun 07, 2010 at 12:16 UTC ( [id://843476]=perlquestion: print w/replies, xml ) Need Help??

lorn has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

I want to do a "realtime" get, LWP or Mechanize support this?

I dont want to wait ->get to return the all data, every byte they get, i want to see/parser something like what 'lynx -dump' do

With a filehandle interface perhaps? :) /me just dreaming...

while(my $line =~ $lwp->get("www.foo.com") ){ #parser $line }

Does anyone know anything like that? or how i can do that using another module?

Replies are listed 'Best First'.
Re: Realtime get with LWP or Mechanize
by weismat (Friar) on Jun 07, 2010 at 12:28 UTC
    There is LWP::Coro which allows non-blocking LWP.
    Could you elaborate why you want to do this as I would expect that usually the time spend on the application server for serving the http request will be longer than the time needed for network communication and the parsing will get more complex when you process incomplete messages - especially fif the parser needs to be really robust.
    If you want to speed up things, look into threads with multiple LWP instances running requests in paralle.

      I work with a proprietary Java CMS ( Fatwire ) that have a 'online' log manager by log4j, for access this log i need to access a admin interface, and see the log in the browser, when the log is bigger the browser crash :/

      So i'm thinking to create a http://github.com/lorn/remote-tail that, will do this for me, and show me the log in a shell console, becasue that i need the 'realtime' get

      Thanks for your help :)

        Wouldn't it be easier to patch Fatwire to take a param(numofbytes) and use tell to only show the last numofbytes from the log?
Re: Realtime get with LWP or Mechanize
by Anonymous Monk on Jun 07, 2010 at 12:22 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://843476]
Approved by almut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-24 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found