"be consistent" | |
PerlMonks |
Re: printing in a specific area of the consoleby Amoe (Friar) |
on Feb 17, 2002 at 21:07 UTC ( [id://146042]=note: print w/replies, xml ) | Need Help?? |
A nice way to do this is the way provided by the LWP::UserAgent module. It allows you to provide a code reference that gets invoked whenever it gets another chunk of a file. Check this:
(Sorry about the tab mess...I'm not sure how to correct it.) Call it like this: my $res = $agent->request($req, $sub, 1024)Where $agent is an LWP::UserAgent, $req is an HTTP::Request and 1024 is the amount of bytes you want to get before invoking $sub. That was ripped from the pronbot source. It allows you to either write binaries directly to file via the FILE handle and the value of $filename, or push the lines of the response onto an array which can later be joined. (You might have do declare some of the vars yourself :) I'd advocate using an LWP module for basic HTTP stuff, it's very easy, although this probably looks complex. -- my one true love
In Section
Seekers of Perl Wisdom
|
|