No I don't want to write a program that gets the username or password, there is this program there already that runs interactively, which prompts the user fro a username and a password. I was trying to get a way to pass a username and a password from a perl script to this executable. This executable doesn't take any command line options and runs interactively as I have shown above.

I tried doing the following, but it fails for some reason:

open (FIFO, "$program |");
print FIFO "$username\n";
print FIFO "$passwd\n";
print FIFO "$passwd\n";
print FIFO "y\n";
close FIFO || die "error closing redirector \n";


The program looks like the following again. <BR
username :
password :
confirm :
Do you want the action to be persistent (y/n) :

The code I have above doesnt run well for some reason. I am trying to make it so the user runs the perl script and doesnt see any output by this program, and the perl script enters the username and password for him.

In reply to Re: Re: redirecting stdin on windows by arkamedis21
in thread redirecting stdin on windows by arkamedis21

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.