lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev -post_data and perl


From: Klaus Weide
Subject: Re: lynx-dev -post_data and perl
Date: Sat, 23 Oct 1999 19:39:58 -0500 (CDT)

On Fri, 22 Oct 1999, Charles Sprickman wrote:

> Basically, if I call lynx like so:
> 
> $result = `echo $postdata | lynx -post_data -source $url`
> 
> everything is fine...  But if I use the "OPEN" method, lynx seems to
> ignore -post_data and it simply does a get of the URL.  An example of what
> I'm trying to do is:
> 
> open (LYNX,"|lynx -post_data -source $url");
> while (<LYNX>) {
> 
> print LYNX ("$postdata\n");
> print LYNX ("\n");
> print LYNX ("-----\n");
> print LYNX ("\n");
> }
> close(LYNX);
> 
> A -trace showed me that in this case it is not doing a post...
> 
> Am I just showing that I'm really new to perl or is something odd
> happening?  

The first, I think.

the condition in your while will lnever be true, therefore you don't
send anything to lynx's stdin.  'while (<LYNX>)' is for *reading*
from a file handle.  You can't; you have opened it as a pipe for
writing.

Dunno why the 'while' anyway, did you plan to send the sme data to
the same process more than once just to make sure?  That doesn't make
sense.

Try checking the status of each command instead, with the usual "or die"
construct.

> I feel it's ignoring the flag because if I run it on the
> command line with -post_data and don't send it any data on STDIN, it just
> sits there.  In this script, it returns very quickly.

You have closed (your writing side to) its stdin after sending it
nothing.

Make sure you actually *do* the 'print's, and it should work.
(and then make sure you get the right format for the input.)

  Klaus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]