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

re: No access to /etc/protocols

Thread Previous | Thread Next
Paul Murphy
February 27, 2002 05:50
re: No access to /etc/protocols
Message ID:

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).


Chat with friends online, try MSN Messenger:

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