Hi there...
Not sure is this is robust enough for your needs, but here are several
ways I've called external programs from within the main perl program:
# PING THE IP ADDRESS PASSED AS ARG1; CAPTURE THE RESPONSE TO ARRAY PINGDATA.
@pingdata = `ping $_[0]`;
In this example, which I yanked from a subroutine that PINGS a remote
IP address, the system PING command, the external program, is called
by enclosing it in the "tick mark" characters. The IP address was
passed to the subroutine as Arg1, and the PING command executes when
the Subroutine executes this line. The results of the PING get stuffed
into the array @pingdata.
Example 2:
$sendcmmd = `send "$sendmsg0" $NovellSr/$CaegAdm1 /B`;
This line calls the Novell system SEND command, passes a couple of 3
arguments. The message that is being sent is stored in the $SENDMSG0
variable; the name of the Novell login server is stored in $NovellSr,
and the User login ID of the local system administrator is stored in
$CaegAdm1; /B means use Bindery mode when the message gets sent. The
whole command string is encoded in the "tick" marks so that it
executes like a command, and the results are store in $sendcmmd.
There are other ways I know, this is a simple way...
If you want to write a program that can go out across the network,
login to a remote device, and actually interact with it, you should
check out the EXPECT program language. This langauge, which is used
within TCL scripts, lets you automate just about any process you would
normally do manually from a CMD, DOS, or CONSOLE window. They sell it
at www.activestate.com ... |