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

[MacPerl] STDIN problem



Hi,
I am a newcomer to this list and pretty new to MacPerl, too.

I have been struggling with a problem which I am sure is really simple,
but I can't seem to find the answer anywhere.

I am having trouble getting my script to read STDIN. I am trying to read
the data from a form using POST. It works fine if I use GET and don't have
to use STDIN, but if I try to use POST, it acts like there is no data to
read. Even

while (<STDIN>) {
  print "$_";
}

isn't producing anything.

Here is my code:

read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;
}

I have tried everything I can think of including getting cgi-lib.pl and
using the ReadParse subroutine from there, which does essentially the same
thing as my code, but I can't get it to read the form data no matter what 
I've tried.

I found a couple places on the web where people were complaining of
similar problems, but I haven't found an answer. This code works perfectly
fine in Perl on UNIX, and I don't understand why my MacPerl doesn't seem
to understand STDIN.

I am using MacPerl 5 under WebStar v. 3.0.2.

Looking forward to any input!

Thanks :)
Frances Schuetz
fschuetz@indiana.edu



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org