Dear Perl Monks, I am writing you to seek enlightenment in the realm of Expect.pm

I have a written a perl expect script that runs as expected when I execute it from a terminal or shell.

However, if I execute it using backticks or the system command from a perl cgi script via browser, I receive the error in the subject line: Given filehandle is not a tty in clone_winsize_from. The file handle I am passing to clone_winsize_from is \*STDIN.

I have read online that it could be an issue with the corresponding profile's .bashrc file and it'd be appropriate to make some edits there, however, the default apache2 account that runs does not currently have a .bashrc nor .bash_profile file. It currently runs under www-data.

Has anybody come across something similar to this before? Apologies if I am asking a question that has already been answered.

Any assistance would be greatly appreciated.

code snippet:

use Expect;
my $exp = new Expect;
my $timeout = 30;
$exp->raw_pty(1);
$exp->slave->clone_winsize_from(\*STDIN);


In reply to Given filehandle is not a tty in clone_winsize_from by chackypandy

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.