# instances (Device|Win32)::SerialPort object and initializes communications sub connect { ... # Connect on serial (use different mod for win32) if( $me->ostype eq 'windoze' ) { $me->port( new Win32::SerialPort($me->{'port'}) ); } else { $me->port( new Device::SerialPort($me->{'port'}) ); } ... # Get the modems attention # Send multiple reset commands looking for a sensible response. # A small number of modems need time to settle down and start responding to the serial port ... my $init_response = $me->send_init_string($init_string) || ''; ... $me-> log -> write('info', 'Ok connected' ); $me-> {'CONNECTED'} = 1; } #### sub is_active { ... # Modem is active if already connected to a line if( $self->flag('CARRIER') ) { $self->log->write('info', 'carrier is '.$self->flag('CARRIER').', modem is connected, it should be active'); $lOk = 1; } else { ... # If DSR signal is on, modem is active my %sig = $self->status(); $lOk = $sig{DSR}; undef %sig; # If we have no success, try to reset if( ! $lOk ) { $self->log->write('warning', 'modem not responding... trying to reset'); $lOk = $self->reset(); } } $self->log->write('info', 'modem reset result = '.$lOk); return $lOk; }