/usr/share/doc/libdevice-serialport-perl/examples/any_os.plx is in libdevice-serialport-perl 1.04-3build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #!/usr/bin/perl
#---------------------------------------------------------------------------
# Author:
# Bruce Winter brucewinter@home.net http://members.home.net/winters
#
# This free software is licensed under the terms of the GNU public license.
# Copyright 1998,1999 Bruce Winter
#
#---------------------------------------------------------------------------
use strict;
use vars qw($OS_win);
BEGIN {
$OS_win = ($^O eq "MSWin32") ? 1 : 0;
print "Perl version: $]\n";
print "OS version: $^O\n";
# This must be in a BEGIN in order for the 'use' to be conditional
if ($OS_win) {
print "Loading Windows modules\n";
eval "use Win32::SerialPort";
die "$@\n" if ($@);
}
else {
print "Loading Unix modules\n";
eval "use Device::SerialPort";
die "$@\n" if ($@);
}
} # End BEGIN
die "\n\nno port specified\n" unless (@ARGV);
my $port = shift @ARGV;
my $serial_port;
if ($OS_win) {
$serial_port = new Win32::SerialPort ($port,1);
}
else {
$serial_port = new Device::SerialPort ($port,1);
}
die "Can't open serial port $port: $^E\n" unless ($serial_port);
my $name = $serial_port->alias;
print "\nopened serial port $port as $name\n";
$serial_port->close || die "\nclose problem with $port\n";
|