My sysopen does not work:
sysopen(DEV, "/dev/ttyS0", O_NONBLOCK|O_RDONLY)
returns 1, which is successful! Then why $! there is an “Illegal search” error in it (where it is not defined before the call)
before sysopen $!:
after sysopen $!: Illegal seek
EDIT: Here is the full script: (using the actual value of O_NONBLOCK | O_RDONLY 2048)
use Device::SerialPort;
my $ob;
$ob = new Device::SerialPort("/dev/ttyS0");
print $!, "\n";
$! = 0;
my $ret = sysopen(DEV, "/dev/ttyS0", 2048);
print $!, "\n";
$! = 0;
print "ret from sysopen: ", $ret, "\n";
which prints:. /filehandle.pl Illegal search Illegal search ret from sysopen: 1
source
share