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


in reply to Calling an executable and entering login credentials

I don't know exactly how Sametime expects to get it's login, can you be more specific what the program does? Does it output a prompt, like Login:? Usually to interact with a program, the Expect module is usually recommended, google for perl Expect for sample code.

In a very simple situation, you may be able to get by with IPC::Open3, which opens the program, and gives you pipes to write to, and read from, the executable.

A simple example:

#!/usr/bin/perl use warnings; use strict; use IPC::Open3; $|=1; # you would run Sametime here, instead of bash my $pid=open3(\*IN,\*OUT, \*ERR , '/bin/bash'); # set \*ERR to 0 to send STDERR to STDOUT # # in your case, print the login name here my $cmd = 'date'; #send cmd to bash print IN "$cmd\n"; my $result = <OUT>; print $result;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh