Thanks for adding your code. Now we can get down to business. I looked at your code, and it seemed to me that you had too much going on. I didn't see any reason for
Getopt::Long; LWP::Debug has been deprecated, and I took out
SOAP::Lite. This is how I would approach it:
#!/usr/bin/perl
use strict;
use warnings;
use HTTP::DAV;
my $source = "/home/jadli_r/sharepoint_test/test.txt";
my $destination = "https://fddld.com/sites/A055/files/";
my $username = "uname";
my $password = "passwd";
my $ua = HTTP::DAV::UserAgent->new( keep_alive => 1 );
my $dav = new HTTP::DAV( -useragent => $ua );
$dav->credentials( -user => $username,
-pass => $password,
-url => $destination,
-realm => "DAV realm",
);
$dav->open( -url => $destination )
or die("Couldn't open $destination: " .$dav->message . "\n");
$dav->lock( -url => $destination, -timeout => "infinity" )
or die "Put requires infinity\n";
if ( $dav->put( -local => $source, -url => $destination ) ) {
print "Successfully uploaded $source to $destination\n";
}
else {
print "Put failed: " . $dav->message . "\n";
}
Note that I'm not sure that you'll need keep_alive with an
infinite lock.