in reply to Re: IPC::Run and scp's password entry
in thread IPC::Run and scp's password entry

I know, but I couldn't bend my mind enough to fully get this... Could you supply an example?

Just to enable more monks to help me:
I start() scp with a proper command. It swallows it without errors and the next thing it does is prompt (blocking) for a password with "\nPassword:" and waits there. I then need to feed my password, but as it seems my code messes the passed string up or passes the wrong value...
  • Comment on Re^2: IPC::Run and scp's password entry

Replies are listed 'Best First'.
Re^3: IPC::Run and scp's password entry
by mr_mischief (Monsignor) on Dec 19, 2008 at 19:56 UTC
    It's not passing anything, because at the point your code first checks the output it does not yet contain the pattern you are searching.

    It also could be that you never get any output from the command resembling what you think it should. Most of the examples for IPC::Run you must remember are using the Unix utility 'cat', which outputs its own input. I doubt whatever scp utility you are using sends the input at the password prompt back to you as output. Others issue a command to a program with a command-then-prompt interface, and they wait for the prompt before issuing another command. You're actually wanting the password prompt before you send the first input and for the next thing to be something telling you about the status of the transfer.

    I'm not sure why you're using this module for scp in the first place, unless you have a reason you can't use Net::SCP, Net::uFTP, or Net::SCP::Expect.

      I am currently having a look into Net::SCP::Expect - I could kick myself for not having the idea to look around cpan for scp wrappers... Thanks!