|
Posted by Paul Lalli on February 7, 2006, 9:28 am
Please log in for more thread options
anu wrote:
> I am tryin to copy a tar file from remote machine to local machine
> using Net:Telnet.
Why? Telnet is not a file transfer proticol. Why not use a module
that *does* interface with a file transfer proticol? Such as Net::FTP
or Net::SCP?
> I am using the following logic :
>
> my(@Out) = $objTelnet->cmd("cat $FromFile");
> $strArg2 = basename $FromFile if $strArg2 eq '.';
> open (FH, ">$strfnArg2") or die "Can't open $strfnArg2 for
> writing: $!";
> print FH @Out;
>
> #closing local file
>
> close FH or die "Can't close $strfnArg2 : $!";
>
> print ("File fetched from remote host successfully");
>
>
> Note: here strArg2 is the filename that is passed as an argument.
>
>
> This logic is working fine for ascii files but doesnt for tar
> files.
"doesn't work" is the worst of all possible error descriptions. What
happens? Syntax error? Run-time error? Empty file? No file?
Corrupt file?
How can we help you when you won't tell us what goes wrong?
> "cat file.tar" i dont know if that is fine.
I don't know what that means.
> And also please do clarify this doubt of mine----" Can we open a
> filehandle for a file on the remote machine using Net::Telnet " if so
> how?
Nothing I saw in my (very brief) examination of the docs suggests that
you can. However, check out Net::SSH, which does seem to have that
ability.
Paul Lalli
|