How do you share an object(Telnet Sesion) between threads? I need the Telnet session below available to 3 threads(connect, disconnect, & scan). $telnetsession is of type Net::Telnet per print(ref($telnetsession)).
This is part of a larger wxPerl script. All of the display and interlocking between the GUI and threads seems to working corectly. Crossposted to wxperl-users. Thanks, James <code> # Define the Thread shared data area - All threads access this scaler data fine my %common : shared; $common{ip} = "127.0.0.1"; # Localhost $common{port} = "7356"; # Local Port as defined in gqrx $common{telnetsession} = 0; # Object Pointer ??? Problem ??? $common{tnerror} = 0; # Status $common{connect} = 0; # Command $common{connected} = 0; # Status $common{disconnect} = 0; # Command $common{scanstart} = 0; # Command $common{scanstarted} = 0; # Status $common{beginf} = 0; # Scan - Beginning Frequency $common{endf} = 0; # Scan - Ending Frequency $common{step} = 0; # Scan - Frequency Step $common{squelch} = 0; # Scan - Minimum RSSI(Recieved Signal Strength Indicator) $common{rssi} = 0; # Scan - Latest RSSI $common{pause} = 0; # Scan - Time between scans - msec $common{listen} = 0; # Scan - Time to Listen to a strong signal - msec $common{mode} = 0; # Scan - Demodulator Type $common{stopthreads} = 0; # Command # Connect the Telnet Session - #1 sub Connect { while(1) { if($common{stopthreads}) {print "\nConnect Thread Terminated\n"; return}; if($common{connect}) { if(!$common{connected}) { print "Open Telnet Connection to gqrx\n"; my $telnetsession = Net::Telnet->new(Timeout => 2, port => $common{port}, Errmode => sub {$common{tnerror} = 1;}); $telnetsession->open($common{ip}); $common{telnetsession} = shared_clone($telnetsession); # Line 92 Errors $common{connected} = 1; $common{connect} = 0; } } threads->yield(); } } </code> <code> Error message: Thread 1 terminated abnormally: Unsupported ref type: GLOB at ./threadedgqrxLite.pl line 92 thread 1 </code>