Automation of tip sessions with perl 
Author Message
 Automation of tip sessions with perl

Hi,

My goal is to automate configuration and testing of certain network equipment
using tip and perl.  I think I'm pretty close except I keep getting:
"tip: must be interactive"..."Use of uninitialized value....Broken pipe.  
I'm using IPC::Open2 for a two-way stream effect and FileHandle.  I'm not
quite sure what's happening but as soon as I try to write to the process, I
get 'Broken pipe' and the program exits.  Can someone familiar with tip
interactions point the way...here's the code sample:

                                - Dwalu
-----
$rdr = new FileHandle;
$wtr = new FileHandle;

my $pid = open2($rdr, $wtr, $tipcmd) or die "$0: Can't do open2\n";
print "pid=$pid\n";
my $res = '';

print "Connected to $DeviceName on $Hostname using $ConfigFile\n" if $opt_v;

print $wtr "\cC\n";
print $wtr "\cM\n";
print $wtr "canc-user;\n";
$res = <$rdr>;
print $res unless !$res;

----Here's my previous test example using 'bc' that worked...
#!/usr/bin/perl -w
use strict;
use FileHandle;
use vars qw /$wtr $rdr/;
use IPC::Open2;

$rdr = new FileHandle;
$wtr = new FileHandle;

my $pid = open2($rdr, $wtr, 'bc') or die "$0: Can't do open2\n";
print "pid=$pid\n";
my $res;


    print $wtr "$_\n";
    $res = <$rdr>;
    print "Wrote '$_' and got: '$res'";

Quote:
}

print $wtr "quit\n";
print "...exiting...\n";
$rdr->close;
$wtr->close;

--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
                                - Student Creed



Fri, 25 Feb 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Open a Session inside Session

2. CGI::Session creates a session even if I don't want it to

3. Apache::Session::MySQL or Apache::Session::DBI

4. MS Word OLE Automation using Perl

5. OLE Automation with Win32 Perl and Word?

6. Need documentation for WORD_BASIC Perl OLE automation

7. Automation via Perl...

8. Need documentation for WORD_BASIC Perl OLE automation

9. Problem with IE automation in Perl

10. OLE Automation via Perl

 

 
Powered by phpBB® Forum Software