I am getting the invalid shared scalar error:
Invalid value for shared scalar at
/usr/lib/perl5/site_perl/5.8.0/BTI/MVP.pm line 101, <GEN0> line 1
I thought if I did self->{telnet} = &shared({}) this would take care of
it. Is there something special I need to do with the Net::Telnet->new
filehandle that it creates?
sub new {
my $class = shift;
my $self = &share({});
$self->{telnet} = &share({});
if (@_) {
my $result = TRUE;
$result = init($self,@_);
if ($result == FALSE) {
$self->{log}->entry("telnet failed",WARN);
}
} else {
$self->{log}->entry("No data to create switch
object",WARN);
}
bless $self, ref($class)||$class;
return $self;
}
sub connect : locked method {
my $self = shift;
##########################################
# Establish telnet connection
##########################################
$self->{telnet} = Net::Telnet->new($self->{address});
$self->{telnet}->input_log("/var/telnet.log");
$self->{telnet}->errmode('return');
$self->{telnet}->print("\cD\cD");
my ($pre, $match) = $self->{telnet}->waitfor(
Match => '/NAME:/',
Timeout => TIMEOUT
);
if (defined $match) {
return TRUE;
} else {
return FALSE;
}
}