Re: Calling Another Application From Perl



M <no_spam@xxxxxxxxx> wrote:
I want to call scp to transfer a file to another server.

Do some reading before.

open(OUT, "|scp $backup_file $user\@$server:./");

Use 3-arg B<open>. Check return value of B<open>. Use lexical
filehandles.

Consider B<Net::SSH>.

print OUT "$pass\n";
close OUT;

Since you write in filehandle, then check return value of B<close> too.

This does not work though. SCP does not allow to specify the password
rather it prompts for it. Is there anyway to answer the prompt for
password with perl?

B<Expect.pm>? (oops, too late).

p.s. oops, just gave B<apt-get> a try, and -- B<Net::SCP::Expect>

--
Torvalds' goal for Linux is very simple: World Domination
.



Relevant Pages

  • Re: Problem adding new line !
    ... reading into that file. ... Here tmp_file1.txt is the destination file ... You will find dealing with filehandles much easier if you use the ... why you got away with the on your sub declarations... ...
    (comp.lang.perl.misc)
  • Re: What the hell is this?!!!
    ... >>Sarg is correct and I have similar experience as well. ... > "When prompted to activate Windows, ... > the prompts and instructions. ... Go back to school, pick any grade below 10th, so that you learn reading ...
    (microsoft.public.windowsxp.general)
  • Re: Microsoft Word xp Problem
    ... Thanks for the advice, done as you suggested, got onto Detect and Repair in ... followed the prompts which includes reading from the set up CD and it ...
    (microsoft.public.windowsxp.help_and_support)
  • Does this Auth script have an unwanted loop?
    ... Found the below script in a book I am reading. ... However it seems to me to fatal flaw that if you run it but type in the ... Program that prompts for a user name and ...
    (comp.lang.php)
  • Re: Gone?
    ... If it's an event that gets me involved, and entertained, I'll post and comment, other than that, I enjoy reading others' comments, and if nothing prompts me to post, I won't. ... Carole. ... Karma means you don't get away with anything. ...
    (rec.sport.curling)