Are you actually using the serial module here?

This is the stuff that gets me working which is a hack of the serial module
example code (OK, more of a straightforward copy than a hack):
This along with the other code examples will be enough to get you working.

Hope it helps,
Toby.

######################### We start with some black magic to print on
failure.

BEGIN { $| = 1; print "myprog.plx loaded "; }
END {print "not ok 1\n" unless $loaded;}
use Device::SerialPort 0.05;
$loaded = 1;
print "ok 1\n";

######################### End of black magic.

# starts configuration created by test1.pl

use strict;

my $file = "/dev/ttyS0";
my $tc = 2;             # next test number
my $pass;
my $fail;
my $in;
my $in2;
my @necessary_param = Device::SerialPort->set_test_mode_active;

my $LogFile= "logfile";

# 2: Constructor

my $ob = Device::SerialPort->new ($file) || die "Can't open $file: $!";

$ob->baudrate(9600)     || die "fail setting baudrate";
$ob->parity("none")     || die "fail setting parity";
$ob->databits(7)        || die "fail setting databits";
$ob->stopbits(1)        || die "fail setting stopbits";
$ob->handshake("none")  || die "fail setting handshake";

$ob->write_settings || die "no settings";


#open ( O, ">>$LogFile") || die "Can't open Logfile";


$fail=0;
while (not $fail) {
    $in = 1;
    while ($in) {

blah blah blah...



                -----Original Message-----
                From:   Robert Canary [mailto:[EMAIL PROTECTED]]
                Sent:   07 March 2000 22:10
                To:     [EMAIL PROTECTED]
                Subject:        [OffTopic] Perl and Serial Devices

                Hi,

                Sorry for another perl question ....

                I have script here as follows:

                --<create Lock file code is here>--

                open (PORTACCESS, "+>>/dev/ttyC0");
                print PORTACCESS "AT\&V1" . "\n\r";

                alarm(10);
                while (<PORTACCESS>) {
                    print;
                    chomp;
                    /OK|ERROR/ && do {
                        close(PORTACCESS);
                        last;
                    };
                }


                The code works fine, except if the modem never responds the
code seems
                to get stuck at "while(<PORTACCESS>)", and strangley enough
the
                alarm(10) never kicks it out.

                Anyone know how I can get arounfd this problem?

                thanks in advance ;-)
                --
                robert canary
                system services
                OhioCounty.Net
                [EMAIL PROTECTED]
                (270)298-9331 Office
                (270)298-7449 Fax



                -- 
                To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe"
                as the Subject.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to