I'm attempting to write to a web server file from a Perl program (ActiveState 5.10) on my Windows XP laptop.

The program seems to run but the file isn't updated. So I'm working on validating the success for failure, displaying the response, understand the security issue at the server level.
Any one want to jump in and add any wisdom that would be great:
1) am I headed in the right direction? I read PUT is less used but more efficient than POST.
2) what's the best way of displaying the response and catching errors?
3) What's the Linux host permissions need to be set at?

4) Can I PUT one file to another?


Code:

use HTTP::Request;
my $request = new HTTP::Request 'PUT', 'http://mysite.com/runstats/ICD-2008.txt';
$request->header('content-length' => 26);
$request->header('content-type' => 'text/plain');
$request->content('xxxxxxxxxxxxxxxxxxxxxxxxxx');
print $request->as_string( );
my $code;
my $msg;
my $header;
my $content;
my $r;
$r = HTTP::Response->new( $code, $msg, $header, $content );
print "\n $r \n";
my $str;
$r = HTTP::Response->parse( $str );
print "\n $r \n";


-------------Response:
PUT http://mysite.com/runstats/ICD-2008.txt
Content-Length: 26
Content-Type: text/plain
xxxxxxxxxxxxxxxxxxxxxxxxxx
HTTP::Response=HASH(0x1b5d4fc)
HTTP::Response=HASH(0x1b5d63c)

In reply to HTTP::Request 'PUT' by kansaschuck

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.