develooper Front page | perl.perl5.porters | Postings from May 2001

[ID 20010506.049] Conteptual mistake in IO::Select

From:
dLux
Date:
May 6, 2001 05:15
Subject:
[ID 20010506.049] Conteptual mistake in IO::Select
Message ID:
E14tHHb-0000o6-00@dl.sch.bme.hu
This is a bug report for perl from dlux@kapu.hu,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------

This bug is only a conceptual bug, and I don't understand how this problem
is not a problem for others. Let me see the manual of the IO::Select:

DESCRIPTION
       The `IO::Select' package implements an object approach to
       the system `select' function call. It allows the user to
       see what IO handles, see the IO::Handle manpage, are ready
       for reading, writing or have an error condition pending.

The implementation of the IO::Select does not cover the whole functionality
of the "select" system call and the "select" perl function, because it can
not handle multi-way connections. I can select to read, write _OR_ error
condition! This is not enough if you want to write a non-blocking one-process
server, which maintains keep-alive connections!

The module needs redesign to allow this functionality, e.g the separation of
the read, write and error-condition file-handles. It is not good if you
simply add a function:

sub can_do_anything {
    my $vec = shift;
    my $timeout = shift;
    my $r = $vec->[VEC_BITS];

    defined($r) && (select($r,$r,$r,$timeout) > 0)
      ? handles($vec, $r)
      : ();
}

This is a bad solution, because it returns when we can write to a socket, and
I cannot tell the module: I don't want to write to this socket.

If you are adventurous, you can rewrite the module to handle that case also.

If you need my help, I can send a patch for it, you only need to apply this.

If you are not intend to change this module, then I will write another one
which will be the _real_ Object-approach of the select system-call in perl.

-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
---
Site configuration information for perl v5.6.0:

Configured by bod at Fri Mar  9 06:08:27 EST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.2, archname=i386-linux
    uname='linux duende 2.4.2 #1 fri mar 2 13:52:32 est 2001 i686 unknown '
    config_args='-Dccflags=-DDEBIAN -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.0 -Darchlib=/usr/lib/perl/5.6.0 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.0 -Dsitearch=/usr/local/lib/perl/5.6.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.0 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.95.3 20010219 (prerelease)
    cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.2.so, so=so, useshrplib=true, libperl=libperl.so.5.6.0
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /usr/local/lib/perl/5.6.0
    /usr/local/share/perl/5.6.0
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.6.0
    /usr/share/perl/5.6.0
    /usr/local/lib/site_perl
    /usr/lib/perl5/5.6/i386-linux
    /usr/lib/perl5/5.6
    /usr/lib/perl5/5.005/i386-linux
    .

---
Environment for perl v5.6.0:
    HOME=/home/dlux
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH=~/lib
    LOGDIR (unset)
    PATH=/opt/bin:/usr/bin:/usr/local/bin:/home/dlux/bin:/home/dlux/projects/shell:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
    PERL_BADLANG (unset)
    SHELL=/bin/bash




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About