develooper Front page | perl.beginners | Postings from February 2002

Re: No access to /etc/protocols

Thread Previous
Jenda Krynicky
February 27, 2002 02:54
Re: No access to /etc/protocols
Message ID:
From:           	"Paul Murphy" <>
> My ISP doesn't have /etc/protocols world readable, and so IO::Socket
> doesn't work, as getprotobyname and getprotobynumber fail.
> I am using the Mail::POP3Client wrapper.
> I am trying to come up with a workaround, and the best I can come up
> with is a horrendous hack to IO::Socket::INET so that it knows that
> tcp is protocol 6 and vice versa.
> My ideal would be to store a local copy of /etc/protocols for Perl,
> and somehow fool it into resolving there rather then the real one.
> Does anyone have any tips?  I can't modify anything too fundamental
> with Perl, as I am running their binary.

What about "replacing" the builtin getprotobyname() and 
getprotobynum() functions:

	sub my_getprotobyname {
	*CORE::GLOBAL::getprotobyname = \&my_getprotobyname;

That looks like the easiest (even though dirty of course) solution.
(Not tested).


=========== == ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
					--- me

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About