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

Re: [MacPerl] Getting data into a CGI script



>At 10:55 am +0100 8/9/98, Sean Carte wrote:
>>>From reading the archives I've concluded that the read function is
>>usually used for getting posted data into a cgi script, like this:
>>
>>read(STDIN, $Var, $ENV{"CONTENT_LENGTH"})
>
>Nope... CGI.pm is "usually" used... it will save you a *lot* of pain...
>promise :-)
>
My reason for not using CGI.pm is that the script ultimately has to run 
on Windows. I thought I'd cross that bridge when I got to it and try to 
keep things as simple as possible (even if that means really complicating 
things in the interim).

>>I have a problem, however, in that the program sending data to the CGI
>>(Authorware Shockwave) does not provide data for the CONTENT_LENGTH
>>variable. I need some other way of reading in the data from <STDIN>. I've
>>tried:
>>
>> while (<STDIN>) {
>>		$string = $string . <STDIN>;
>>}
>>
>>but that doesn't work; it seems to get itself into a loop and eventually
>>time out. Is there another way that I can get the cgi to step through
>><STDIN> until it's empty?
>
>Something more like this...
>
>	my $output = '';
>	my ($n, $buff);
>	while ($n = read(STDIN, $buff, 1024)) {
>		$output .= $buff;
>	};
>
That's exactly the sort of thing I was after. Thank you! I suppose, in 
time, I'll be able to think of things like that too.

Unfortunately it doesn't work. It seems to get into a loop. I wonder what 
Shockwave is sending it?

Thanks for the help, though; it's been educational!


My brain hurts!
SeanC
                     Mediatek Training Institute
   1st Floor Media Park, 129 Moore Road, Berea, Durban, South Africa
   phone: +27 (0)31 305 4200              SeanC@mediatek.co.za
   fax: +27 (0)31 305 4236                Mediatek@global.co.za


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch