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

re: No access to /etc/protocols

Thread Previous | Thread Next
From:
Paul Murphy
Date:
February 27, 2002 05:50
Subject:
re: No access to /etc/protocols
Message ID:
F73b1s7nlT2NqFJ3sl30000268f@hotmail.com

Thanks Jenda.

Is there a particular way I have to implement this?  I have the following 
code but it runs the normal getproto rather than my one.

--------------------------------------
#/bin/perl -w

	sub my_getprotobyname {
		print "hello";
	}
	*CORE::GLOBAL::getprotobyname = \&my_getprotobyname;


	print "Going to function\n";

	my @test = getprotobyname("tcp");

	print @test;

---------------------------------


Jenda said:

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


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


Thread Previous | Thread Next


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