use Net::Telnet(); use strict; use warnings; package L_Switch; sub new { my $class = shift; my ($location, $ip, $time, $client) = @_; my $self = {}; my $sucClass; if ((defined $client) and ($client eq "Veda")){ $subClass = "L_Switch::L_Veda"; } eval "use $subClass;"; eval "\$self = $subClass -> new();"; } sub login { my $self = shift; my $utility = L_Utility -> new(); $self -> {'telnetConn'} -> open($self -> {ip}); $self -> {'telnetConn'} -> login($self -> {'username'}, $self -> {'password'}); if ($self -> {'time_out'} == 1) # checking timed-out switches { $self -> {'full_info'} = $self -> {'full_info'} . "," . $self -> {'location'}; $self -> {'full_info'} = $self -> {'full_info'} . "," . $self -> {'fault'} . "," . $self -> {'time'} . ",,,,,"; return $self -> {'full_info'}; } return "0"; } 1;