General
cancel
Showing results for 
Search instead for 
Did you mean: 

Regrarding Automating the Login to one of the CISCO nodes using Expect.pm cpan module in perl

sowm18
Occasional Contributor

Regrarding Automating the Login to one of the CISCO nodes using Expect.pm cpan module in perl

Hi,

Iam writing the script in perl(oops) to Automate the Login and execute some commands on CISCO nodes.
These Nodes have Both Secure and Unsecure shell types and we can provision any one.
But i want the script which should login using "SSH",if it fails then login using "Telnet" like ,
my $Exobj = new Expect; ##creating an Expect Obj
$Exobj->spawn(ssh );
2.expect username
3 send username
4. expect pwd
5.send pwd
6.return object.
Now my problem is if SSh fails then it has to spawn Telnet and shud continue with step 2 to step 6.
I want step 2 to step 6 common for both the spawn's(i.e for Telnet and SSH).If in both ths cases we get EOF then throw an error.

Please if any one knows about spawning a process within a process plz let me know.
and also let me know implementing Expect within Expect is possible or not.

Thank u

Regards,
BS