http://www.perlmonks.org?node_id=1023294

dfdumont has asked for the wisdom of the Perl Monks concerning the following question:

I see at least one other has had issues with xinetd. It also exhibits the same condition for me from cron, from an at job, even from a script that I've nohup'd and then logged out of the session. Apparently a controlling vty is needed.

The code segment itself looks like this:

if( $options{protocol} eq 'ssh' ) { unless( defined $options{userid} ) { die "userid is a required parameter when using ssh\n"; } if( $options{login} and not defined $options{passwd} ) { die "passwd is a required parameter for ssh if login is true\n"; } @args = ( '/usr/bin/' . $options{protocol}, '-l', $options{userid} +, '-p', $options{port}, '-q', '-o','StrictHostKeyChecking=no',$option +s{target} ); } elsif( $options{protocol} eq 'telnet' ) { @args = ( '/usr/bin/' . $options{protocol}, $options{target}, $opt +ions{port} ); if( $options{login} ) { unless( defined $options{userid} and defined $options{passwd} ) +{ die "userid and passwd are both required parameters for telnet + if login is true\n"; } } } else { die "Unknown protocol specified: $options{protocol}\n"; } if( $options{logging} ) { unless( defined $options{logfile} ) { $options{logfile} = "$options{target}.log"; } open( $options{fh}, ">", $options{logfile} ) || die "Can't open fi +le $options{logfile}: $!\n"; } # ==================================================================== +========= # Spawn the child process to contact the target device # ==================================================================== +========= $options{pty} = IO::Pty::Easy->new; $options{pty}->spawn(@args) or die "Unable to spawn child process: $ +!\n";

at which point I unuversally get the "Unable to spawn child process" with no error number.

And yes, it works fine if I fire off the script from an interactive shell. That is the only way it does work.

What am I missing? I can't believe anything in Perl would REQUIRE an interactive shell.

(Oh and its running on CentOS 6.3 - so Linux not Windows)

Please advise.