Re: Display progress or partial results in browser window

sebb <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
On 25/11/05, Bruce McKenzie <[email protected]> wrote:
> Hi.
>
> I've written an agent (using Mech) to search for audiobooks and eAudio
> books in several libraries. As this takes quite a while, I'd like to be
> able to make the browser display progress results.
>
> I can launch the agent and then launch another script in a browser that
> reads periodically from a file written by the agent. But this seems like
> an awkward solution.

Why not just have the agent print to STDOUT or STDERR?

> I have very little experience with interprocess control, but I thought I
> should be able to launch the spider script to run in the background with
> a system call and then redirect to a perl script that will refresh
> periodically and display the books (or number of books) retrieved in a
> browser window. But I haven't been get the browser to do anything until
> the child process is finished.

That may be a feature of the browser.
Try outputting a lot of blank lines to get it to display.
Have you set autoflush on and/or disabled output buffering?

> There is a script published in Linux magazine by Randal Schwartz
> http://www.linux-mag.com/content/view/1122/2222/ that works along these
> lines, but it doesn't work on my Win32 machine. (Its example of a long
> process is  "exec traceroute" -- the only change I made was to make this
>   Win32's "exec tracert" )
>
> I've tried to find the solution in Learning Perl, the Perl Cookbook and
> Perl FAQ, but the material dealing with IPC seems geared to running from
> the command line.
>
> Is there a basic tutorial that covers  forking thing somewhere?
>
> Thx,
>
> Bruce
>
> --
> Bruce McKenzie
> http://www.2MinuteExplainer.com
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.