morphyno has asked for the wisdom of the Perl Monks concerning the following question:

I have a script right now that opens a serial session. However, the script assumes the serial session is available and does not throw any warnings/exceptions when session is not
$self -> {'_serial'} = Net::Appliance::Session -> Transport' => 'Seri +al'); eval { $self -> {'_serial'} -> connect('Name' => $uid, 'Password' => $pass, 'Parity' => 'none', 'Line' => $dev_id, 'Speed' => $baud_rate); }; if (@) {carp "Error: Device $dev_id is already in use};
Can anyone suggest a method to handle in this type of exception? One work around is to check the availability of the device via system calls, but that solution won't always work for console servers.....
  • Comment on Net::Appliance::Session::Transport::Serial connection exception if device is already in use
  • Download Code