dooberwah has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to learn some basic network communications using the IO module. After
reading the man pages for IO::Socket and IO::Select I wrote the following
test script:
#!/usr/bin/perl -w use strict; use IO::Socket; use IO::Select; my $s = IO::Select->new(); $s->add(\*STDIN); my $foo; my $msg; $s->can_read(); foreach $foo ( $s->can_read() ){ $foo->recv($msg, 1024, 0); print "$msg\n"; }
To me, this looks like it should work fine, but instead of running smoothly it
produces this error message:
Can't locate object method "recv" via package "IO::Handle" (perhaps you forgot
to load "IO::Handle"?)
Now, I didn't load IO::Handle, because I didn't need any of the functions from it directly. I realize that IO::Socket inherits from IO::Handle, but shouldn't that just take care of itself behind the scenes?
-Ben Jacobs (dooberwah)
http://dooberwah.perlmonk.org
"one thing i can tell you is you got to be free"
Edit: Added <code> tags. larsen
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problems with IO::Socket and recv
by Aristotle (Chancellor) on Jun 05, 2002 at 16:58 UTC |
Back to
Seekers of Perl Wisdom