And yet another one! This is part of the ongoing saga getting some low level
pipe based code ported to VMS. The hitch I have hit this time is on the use
of the IO::Select module to handle timeouts on the input channel. To
demonstrate the problem, I dummied up the following, and verified this works
100% on Unix;

#!/usr/local/bin/perl -w

use IO::Select;

$timeout = 2;
$io_sel = IO::Select -> new ();
$io_sel -> add (\*STDIN);

# Wait for STDIN to be available, or timeout after 2 seconds. If
# no channels are available, we timed out

@channels = IO::Select -> select ($io_sel, undef, undef, $timeout);
if (@channels == 0)
{
    print ("Timeout\n");
}
else
{
    $inp = <STDIN>;
    print ("Input was - $inp");
}
exit;

The IO::Select -> select method should wait for any of the added file
descriptors to become available (in this case only STDIN), or for the
timeout period to expire, before completing. This works fine on Unix, but
will only complete on timeout for VMS (ie. it totally ignores any input to
STDIN). This is the same behaviour I was seeing with the mailboxes.

According to the VMS Perl documentation, the select system call is supported
in VMS, which I assume is the call that underpins the IO::Select module. I
haven't tried calling the Perl select function directly, but will try that
as well.

Is anyone aware of any problems here, or any assumptions I am making that
are wrong? Is anyone using either the IO::Select module or Perl's select ()
on VMS? If there are problems here, any other ideas on achieving the same
thing (single channel input with a timeout) - I suppose I can always use the
poor man's alarm based timeout if I need to.

Thanks for all the help on this and the previous problems. It's been much
appreciated.

Andrew

Reply via email to