in reply to Passing IO::Socket::INET

When I played like this it was writing a SMTP and POP module (just cause it was a good exercise)..

# # initialization # $self->{'sock'} = IO::Socket::INET->new( args => 'go_here', ) || die "Cant create socket\nReason: $!\n"; # #retrieval for use # $sock = $obj->_get_sock(); sub _get_sock { return($_[0]->{'sock'}); }
I honestly shouldn't be playing like that, cause I'm not quite sure how it works, only simply that it does. So I am assuming you could do something similar by storing it in a hash or even in an array and passing the hash/array around and then pulling the reference to the socket back out of the data structure.

Hopefully someone more wizardly will explain what is going on. I believe that the IO::Socket returns a object, which is really just a blessed reference to a data structure. So you should be able to say.
$sock = IO::Socket::INET->new( args => 'go_here', ) || die "blah\n$!\n"; $sock_ref = \$sock; some_func($sock_ref); sub some_func { $ref = shift; $sock = ${$ref}; $line = <$sock>; }
Edit: I should clarify a little I guess, I do know how the code works, and what I am passing around, and even what is going on in _get_sock, Im just not overly familiar with OOP. I use it, but I don't understand all of the inner workings of perl OOP, and there are better ways to play with sockets. It was simply a shotgun approach, which proved I could prototype what I wanted and get a working model. I probably should have read your code, as opposed to simply assuming you wanted to know how to pass a socket around.

/* And the Creator, against his better judgement, wrote man.c */