Re: [Hampshire] Possibly daft Perl/DOS question

Top Page

Reply to this message
Author: Victor Churchill
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Possibly daft Perl/DOS question
On 13/07/07, Bond, Peter <PBond@???> wrote:
> Hi -
>
> I'm having a wee bit of a problem uploading a file (via HTTP POST) to a suspect webserver. Works fine from different browsers on WinXP, fails with Firefox on CentOS, fails with the Perl script I've cobbled together. I'm using the LWP::UserAgent & HTTP::Request::Common modules for the post request, and I'm wondering if the server is failing because it is expecting CR/LF pairs.
>
> So after all that babbling - is there an easy way to force Perl to make use of CR/LF in all it's methods?


I use the special variables $/ and $\ to define your output and input
delimiters respectively.

If you put near the start

use Socket qw/:DEFAULT :crlf/;

then you can say

$/ = $CR$LF;      #(or $CRLF)


prior to your output statements.

>From `man Socket` :

       Also, some common socket "newline" constants are provided: the con-
       stants "CR", "LF", and "CRLF", as well as $CR, $LF, and $CRLF, which
       map to "\015", "\012", and "\015\012".  If you do not want to use the
       literal characters in your programs, then use the constants provided
       here.  They are not exported by default, but can be imported individu-
       ally, and with the ":crlf" export tag:


           use Socket qw(:DEFAULT :crlf);


hth

victor