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

Re: No access to /etc/protocols

Thread Previous
From:
Jenda Krynicky
Date:
February 27, 2002 02:54
Subject:
Re: No access to /etc/protocols
Message ID:
3C7CC8ED.4933.84E75BE@localhost
From:           	"Paul Murphy" <muffskiz@hotmail.com>
> 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).

Jenda

=========== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==========
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


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