Nick Paszty <[EMAIL PROTECTED]> wrote:
> we have perl installed on vms and i'm trying to get my html form field
> parser to work. i've been using the following form parser on unix
> without a problem (different path to interpreter).
>
> #!lardat4disk:[perl]
This should be the name of the perl interpreter executable, not just the path.
But it shouldn't matter on VMS.
> print "Content-type: text/html\n\n";
>
> $contentLength=$ENV{'CONTENT_LENGTH'};
> read(STDIN,$formData,$contentLength);
>
> foreach $pair(split(/&/,$formData)){
> # for each pair, split $key (name) and $value variables;
> ($key,$value)=split(/=/,$pair);
> # get rid of the pesky %xx encodings;
> $key=~ tr/+/ /;
> $key=~ s/%([\da-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value=~ s/%([\da-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value=~ tr/+/ /;
> # use the $key as an index for $parameter hash table, $value as the value;
> $parameters{$key}=$value;
> }
You're aware of the fact that you can't use e.g. <SELECT MULTIPLE> fields
with that, are you?
> since we're on vms, i've changed the read line to the following
>
> read(SYS$INPUT,$formData,$contentLength);
>
> here is the error
>
> Missing comma after first argument to read function at test_parser.pl
> line 6, near "$contentLength)"
> Execution of test_parser.pl aborted due to compilation errors.
> %SYSTEM-F-ABORT, abort
read()'s first parameter is a file handle which "SYS$INPUT" certainly isn't
(it isn't a valid parameter either - if it's supposed to be a string, you
must quote it. And if you double-quote it, you must escape the "$").
> i am assuming that SYS$INPUT on vms is analogous to STDIN on unix.i
> think i need to mask the $ character in SYS$INPUT.
Use STDIN.
Or open() SYS$INPUT and use the file handle open() returns (I seem to
remember that if you use Apache under VMS, this should be APACHE$INPUT).
Or (the best advise): Use CGI.pm. This works.
cu,
Martin
--
So long, and thanks | Martin Vorlaender | VMS & WNT programmer
for all the books... | work: [EMAIL PROTECTED]
In Memoriam Douglas Adams | http://www.pdv-systeme.de/users/martinv/
1952-2001 | home: [EMAIL PROTECTED]