Hi,
I am having trouble getting a perl script that uses Event.pm to work
correctly on the IRIX platform. I have attached the code. (It's a
prototype, and yes, it's mostly plagiarized. ;) First the program opens
up a listen port. Then it registers an event on the listen port and
goes into loop(). The problem is that the event goes off (even though
nothing has tried to connect) and it blocks in the accept(). I have
tried this on solaris and linux and had no problems.
We are running Event-0.76 at work. Also, perl5.005_02 and IRIX
6.5.?. I would upgrade to the latest version of Event (0.78?) but we
have to go through a lengthy ;( security proceedure to get code in.
Before I do that, I would like to know if this is a known problem and
if there's a fix.
Another option I was wondering about: it looks like the poll() is being
used over the select(). We have a C library that is similar to Event
at work (although not as robust as Event) and it sits in a select()
call.
Would that make any difference? I say that b/c I found one email on
the mailing list that indicated IRIX implements poll() differently.
On Thu, Jul 06, 2000 at 10:19:02AM +0200, [EMAIL PROTECTED]
wrote:
> Although my previous patch works, it doesn't solve the real problem.
> I have tested a bit more and found out that you cannot set POLLHUP in the
> events field on IRIX. This will cause an immediate return by poll which
> causes the excessive CPU usage.
> ...
How would one recompile Event.pm with select over poll? (I couldn't find
where the HAS_POLL was being set.)
Thanks!
Trey
acceptor.pl
#!/usr/bin/perl -w
use strict;
my $ping_msg;
# fixme
my $start_format = "%10s %10d";
my $ping_format = "%10s %10d";
my $stop_format = "%10s %10d";
sub encode_ping {
my $ping_type = shift;
my $one_up = shift;
if ($ping_type =~ /start/) {
$ping_msg = sprintf ($start_format, $ping_type, $one_up);
} elsif ($ping_type =~ /ping/) {
$ping_msg = sprintf ($ping_format, $ping_type, $one_up);
} elsif ($ping_type =~ /stop/) {
$ping_msg = sprintf ($stop_format, $ping_type, $one_up)
}
return $ping_msg;
}
sub decode_ping {
my $ping_type = shift;
my $return_msg;
if ($ping_type =~ /start/) {
$return_msg = "starting";
} elsif ($ping_type =~ /ping/) {
$return_msg = "pong";
} elsif ($ping_type =~ /stop/) {
$return_msg = "stopping";
}
return $return_msg . "\n";
}
pinger.pl