cloning HTTP::Request uri
Jeffrey Behr (behr@shadowlink.net)
Wed, 17 Nov 1999 10:31:55 -0700 (MST)
Hi,
I'm using WebFS::FileCopy 1.01 to transfer files and seem to be
running into a problem with the HTTP::Request:clone method. I'm
trying to utilize a WebFS capability to move multiple files to a
single destination directory simultaneously, and in the process
the filename is stripped from each "from" URI and appended to the
directory URI to create a URI to put the content "to".
WebFS::FileCopy:copy_urls uses LWP::Request (HTTP::Request) objects
and clones the "to" Request's (directory) URI before appending the
filename to the cloned URI. I appear to be getting a copy as the
cloned Request, but for some reason as soon as the cloned Request
URI is updated, so is the original. The URI clone is done in
HTTP::Request:clone.
The following code from WebFS::FileCopy:copy_urls (1.01) interlaced
with print output might help display some of this:
foreach (@to) {
print "Input ref: $_\n";
Input ref: LWP::Request=HASH(0x8491a40)
my $put_req = $_->clone;
my $to_uri = $put_req->uri;
# If the to URI is a directory, then copy the filename from the
# from URI to the to URI.
if (_is_directory($to_uri)) {
my @from_path = split(/\//, $from_uri->path);
print "Input ref: $_\n";
print "Cloned ref: $put_req\n";
print "Input Uri: ",$_->uri,"\n";
print "Cloned Uri: $to_uri\n";
Input ref: LWP::Request=HASH(0x8491a40)
Cloned ref: LWP::Request=HASH(0x84e4e74)
Input Uri: file:/public/GamitProc/Input/Rinex/1999/312/
Cloned Uri: file:/public/GamitProc/Input/Rinex/1999/312/
$to_uri->path($to_uri->path . $from_path[$#from_path]);
print "Input ref: $_\n";
print "Cloned Ref: $put_req\n";
print "Input Uri: ",$_->uri,"\n";
print "Cloned Uri: ",$put_req->uri,"\n";
Input ref: LWP::Request=HASH(0x8491a40)
Cloned Ref: LWP::Request=HASH(0x84e4e74)
Input Uri: file:/public/GamitProc/Input/Rinex/1999/312/sio33120.99o.Z
Cloned Uri: file:/public/GamitProc/Input/Rinex/1999/312/sio33120.99o.Z
$put_req->uri($to_uri);
}
I'm using lwp 5.44 and LWPng 0.24 on Linux 2.2.12 and hoping I'm not missing
something obvious.
Thanks,
Jeff
Jeff Behr jeffb@shadowlink.net