in reply to Re^2: Problems with IO::Select
in thread Problems with IO::Select

The request was to "Please, post a minimal, working example so we can play with it". What you posted is neither minimal (we shouldn't need get_config or a config file) nor working (get_config is missing. A sample config file is missing. IP_SOCKET is not defined. UNIX_SOCKET is not defined.)

The following works (can_read doesn't return) for me. Does it do the same for you? If so, your problem has nothing to do with the socket or select.

use strict; use warnings; use IO::Socket; use IO::Select; my $sel = IO::Select->new(); my $address = "mysock"; unlink($address); my $sock = IO::Socket::UNIX->new( Type => SOCK_STREAM, Listen => 5, Local => $address ) or die("Unable to create socket $!\n"); chmod 777, $address; $sel->add($sock); while(my @ready = $sel->can_read) { warn; }

Replies are listed 'Best First'.
Re^4: Problems with IO::Select
by dirtdart (Beadle) on Jul 02, 2006 at 21:22 UTC

    I assumed, when asked for a sample, that one would have meant a sample of the program I'm working with, not just some other program I made up. Next time I guess I'll know.

    However, the above code does the exact same thing. as soon as it reaches can_read, it craps out with no discernable error and no output.

      I guess I wasn't clear, if "Next time you guess you'll know."

      "Working" means it must still exhibit the problem. All I got was "Undefined subroutine &main::get_config called". That's not the problem you asked us to solve.

      "Minimal" means that anything everything that doesn't affect the error should be removed. If anything else were to be removed, the code would no longer exhibit the problem.

      I didn't "make up" anything. I just stripped out the config code and the IP socket code. (Update: Oops, I did switch from the indirect method call syntax to the direct one, because there are problems associated with the indirect method call syntax.) Since the remaining code still give the error you are trying to fix, that means I eliminated your config code and your IP code as possible sources of the problem. If it had solved the problem, that means the error was in the config code or the IP code.

      What OS and Perl are you using? Maybe they don't support features you require.

        I'm running SuSE Linux 10.0. My Perl version is 5.8.7. My IO version is 1.23 and according to the CPAN module it is up to date.