Perl with SerialPort

Dave Korn
Wed Feb 13 23:50:00 GMT 2008

On 13 February 2008 22:46, Dave Korn wrote:

> On 13 February 2008 21:23, curator wrote:
>> So the question is: i would like to prefer no 2. For that i have to install
>> SerialPort for Perl for cygwin.
>> Is this possible, and if yes, could you tell me how?
>   I'm no perl expert, 

  Still true, but I've found one thing out since sending that: you'll want
Device::SerialPort instead of Win32::SerialPort.

> but from what I've read on the list it seems that
> cpan works under cygwin for most perl modules.  Give it a try and let us
> know how it goes.  

  Fails at the testing stage, reporting:

Running make test
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/01timing.............ok 4/7
t/01timing.............NOK 7#     Failed test (t/01timing.t at line 33)
# then: 207441765 now: 207443905 diff: 2140
# Looks like you failed 1 test of 7.
        Test returned status 1 (wstat 256, 0x100)
        Failed 1/7 tests, 85.71% okay
        all skipped: No serial port selected for use with testing
        all skipped: No serial port selected for use with testing
        all skipped: No serial port selected for use with testing
        all skipped: No serial port selected for use with testing
Failed Test  Stat Wstat Total Fail  Failed  List of Failed
t/01timing.t    1   256     7    1  14.29%  7
4 tests skipped.
Failed 1/5 test scripts, 80.00% okay. 1/7 subtests failed, 85.71% okay.
Makefile:868: *** [test_dynamic] Error 255

#0  test_dynamic at /home/dk/.cpan/build/Device-SerialPort-1.04/Makefile:868
#1  test (.PHONY target)
Command-line arguments:
  /artimi/tools/cygwin/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

  I'd suggest going ahead with the force install (which I don't know how to do
yet), because looking at 01timing.t:-

# We need to test that the "get_tick_count" function actually works
# as expected, since we use it during other tests to verify toggle
# speeds, hang ups, etc.

can_ok('Device::SerialPort',qw(get_tick_count)); # test

my $then;
ok(defined($then = Device::SerialPort->get_tick_count),
	"get_tick_count returns a number"); # test

ok(sleep(2) <= 2, "sleep sleeps"); # test

my $now;
ok(defined($now = Device::SerialPort->get_tick_count),
	"get_tick_count still returns a number"); # test

ok( ($now-$then) >= 1000, "measured sleep as more than 1 second")
	or diag("then: $then now: $now diff: ".($now-$then)); # test

# Allow 100ms fudge-time for slow calls, etc
ok( ($now-$then) <= 2100, "measured sleep as less than 2 seconds")
	or diag("then: $then now: $now diff: ".($now-$then)); # test

... I'd say it's a bit over-sensitive.  Won't necessarily do anything except
tell you that you're running on a multi-tasking OS.  POSIX explicitly says
"The suspension time may be longer than requested due to the scheduling of
other activity by the system" about the sleep() function, and I'd assume perl
sleep()'s behaviour reflects that.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list