Ask a Question related to PERL Miscellaneous, Design and Development.
-
Ed W #1
IO:Select - what did I do wrong?
Can't see what's wrong with this code... It's running under windows XP with
activestate perl 5.6.1 (which may well be part of the issue...).
The following code gives me an error:
Error in select: Bad file descriptor at io_select_test.pl line 11.
....However, it is pretty much straight out of the man pages.
The problem I am trying to solve is how to read from a bunch of sockets with
a blocking select, but also read from Stdin. I guess I could make my select
only block for 1/2 sec or so and then poll stdin, but there must be
something better than this? (in fact I seem to have some probs doing
non-blocking input from stdin under win32... Is this normal, does it work
for other people...)
#!perl -w>>>>>
use strict;
use warnings;
use IO::Socket;
use IO::Select;
my $r = IO::Select->new(\*STDIN);
$|=1;
my ($rr) = IO::Select->select( $r )
or die "Error in select: $!";
print "Success";
Ed W Guest
-
#25474 [Bgs]: posting arrays from a select box with multiple select is not working properly
ID: 25474 User updated by: fmuller at cisco dot com -Summary: apache2filter: posting from a multiple select box is not... -
#25474 [Fbk->Opn]: posting arrays from a select box with multiple select is not working properly
ID: 25474 User updated by: fmuller at cisco dot com Reported By: fmuller at cisco dot com -Status: Feedback... -
#25474 [Opn->Fbk]: posting arrays from a select box with multiple select is not working properly
ID: 25474 Updated by: sniper@php.net Reported By: fmuller at cisco dot com -Status: Open +Status: ... -
field seperator in select / wrong statement ?
Hi, is there a way to set a field-seperator for the output? I have to get a row of fields which also can contain spaces. So the blank for the... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id, -
Greg Bacon #2
Re: IO:Select - what did I do wrong?
In article <Ac28b.12779$Os1.86997@news.easynews.com>,
Ed W <dodgynewsgroups@ewildgoose.demon.co.uk> wrote:
: Can't see what's wrong with this code... It's running under windows XP with
: activestate perl 5.6.1 (which may well be part of the issue...).
:
: The following code gives me an error:
:
: [my $r = IO::Select->new(\*STDIN);]
:
: Error in select: Bad file descriptor at io_select_test.pl line 11.
According to the perlport manpage:
select RBITS,WBITS,EBITS,TIMEOUT
Only implemented on sockets. (Win32, VMS)
Hope this helps,
Greg
--
Although the South would have preferred any honorable compromise to the frat-
ricidal war which has taken place, she now accepts in good faith its consti-
tutional results, and receives without reserve the amendment which has already
been made to the constitution for the extinction of slavery. -- Robert E. Lee
Greg Bacon Guest
-
Edward Wildgoose #3
Re: IO:Select - what did I do wrong?
"Greg Bacon" <gbacon@hiwaay.net> wrote in message
news:vm1cut68iasm85@corp.supernews.com...with> In article <Ac28b.12779$Os1.86997@news.easynews.com>,
> Ed W <dodgynewsgroups@ewildgoose.demon.co.uk> wrote:
>
> : Can't see what's wrong with this code... It's running under windows XPAhh nuts. Thanks. I hadn't thought to look in the perlport manpage.> : activestate perl 5.6.1 (which may well be part of the issue...).
> :
> : The following code gives me an error:
> :
> : [my $r = IO::Select->new(\*STDIN);]
> :
> : Error in select: Bad file descriptor at io_select_test.pl line 11.
>
> According to the perlport manpage:
>
> select RBITS,WBITS,EBITS,TIMEOUT
>
> Only implemented on sockets. (Win32, VMS)
>
> Hope this helps,
Any suggestions for the best way to do this? I thought either:
a) writing a socket interface into my code
b) converting to "wheel" type code, or perhaps wxwindows (since my GUI app
will be in this)
c) run a blocking select with timeout and check stdin occasionally
Anything else I should look at...?
Ta
Ed W
Edward Wildgoose Guest
-
Greg Bacon #4
Re: IO:Select - what did I do wrong?
In article <rJ28b.981019$Bf5.140355@news.easynews.com>,
Edward Wildgoose <Ed+nospam@ewildgoose.demon.co.uk@> wrote:
: [...]
:
: Anything else I should look at...?
Install an operating system? :-) :-) :-)
Greg
--
In a literary light, if UNIX is the Great Novel, Perl is the Cliffs Notes.
-- Thomas Scoville
Greg Bacon Guest
-
Ed W #5
Re: IO:Select - what did I do wrong?
> : Anything else I should look at...?
Yeah, fair enough....>
> Install an operating system? :-) :-) :-)
....It's going to be used by other people though, and the spec indicates MS
windows....
....oh well
Thanks
Ed W
Ed W Guest
-
Greg Bacon #6
Re: IO:Select - what did I do wrong?
In article <0d58b.19738$Os1.159146@news.easynews.com>,
Ed W <dodgynewsgroups@ewildgoose.demon.co.uk> wrote:
: > Install an operating system? :-) :-) :-)
:
: Yeah, fair enough....
:
: ...It's going to be used by other people though, and the spec indicates MS
: windows....
:
: ...oh well
Have you considered feeding STDIN to a socket and adding the target
socket to your fd_set? Lucky for you that recent versions of perl on
Win32 have fork emulation.
Greg
--
Government seems to operate on the principle that if even one individual
is incapable of using his freedom competently, no one can be allowed to
be free.
-- Harry Browne
Greg Bacon Guest
-
Heinrich Mislik #7
Re: IO:Select - what did I do wrong?
In article <0d58b.19738$Os1.159146@news.easynews.com>, [email]dodgynewsgroups@ewildgoose.demon.co.uk[/email] says...
Try cygwin. [url]http://www.cygwin.com/[/url]>>> : Anything else I should look at...?
>>
>> Install an operating system? :-) :-) :-)
>Yeah, fair enough....
>
>...It's going to be used by other people though, and the spec indicates MS
>windows....
It's perl port runs fine with your test program.
--
Heinrich Mislik
Zentraler Informatikdienst der Universitaet Wien
A-1010 Wien, Universitaetsstrasse 7
Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140
Heinrich Mislik Guest



Reply With Quote

