Hi,

I'm setting a system which allows users to upload files to a web server.

The server is running HP Secure Web Server (aka Apache) V1.3 on OpenVMS
Alpha 7.3-2.  Perl 5.006.01 is installed to work with Apache.

I have a form which is generated using the CGI.pm module and it includes
a file upload button.  The Perl script invoked by the form receives the
file as described in the CGI.pm documentation and I want it to pass the
file's data to a subprocess.

The subrocess is created using a Perl 'open' statement:

    $pid = open(OUTFILE, "| program params ...");

where 'program' is a command to invoke a program the subprocess uses to
process the input stream.  The Perl program uses the method described in the
CGI.pm documentation to transfer data to the subprocess:

    $file = upload('source_file');
    while ($bytesread = read($file, $buffer, 512)) {
        print OUTFILE $buffer;
        print LOGFILE "Buffer: ($bytesread)>$buffer<\n";
    }

I want the subprocess to receive data in 512-byte lumps through it's mailbox
without any or formatting by Perl or the CRTL.  However what I'm finding is
that by the time the data arrives in the subprocess' mailbox it's been split
into multiple writes with at each occurrence of \n, and the \n's have been
removed from the data stream.

This would be OK if I was only dealing with text files; the subprocess could
treat each record in the mailbox as a line in the file and handle it
correctly.  However the processing has to handle binary files too and in
that case it can't assume that every record in the mailbox should be treated
as if there was a \n character in the original data.

I think what I'm asking for is binmode-type processing on the data being
passed to the mailbox, but is this possible?

Thanks,

        Jeremy Begg

  +---------------------------------------------------------+
  |            VSM Software Services Pty. Ltd.              |
  |                 http://www.vsm.com.au/                  |
  |       "OpenVMS Systems Management & Programming"        |
  |---------------------------------------------------------|
  | P.O.Box 402, Walkerville, |  E-Mail:  [EMAIL PROTECTED] |
  | South Australia 5081      |   Phone:  +61 8 8221 5188   |
  |---------------------------|  Mobile:  0414 422 947      |
  |  A.C.N. 068 409 156       |     FAX:  +61 8 8221 7199   |
  +---------------------------------------------------------+

Reply via email to