However it doesn't work. What am I doing wrong?
AnyEvent::DNS::DOMAIN_PORT is a constant function, which means it gets inlined, and within AnyEvent::DNS, the instances of DOMAIN_PORT are replaced by 53 by the compiler by the time the module is loaded and before control returns to your code. (See e.g. perl -MO=Deparse "`perldoc -l AnyEvent::DNS`")
At the moment, I don't see a way to modify the value of DOMAIN_PORT within AnyEvent::DNS itself from the outside, meaning you may have to resort to modifying the module's code. Constant Functions explains several ways to prevent inlining.
(There may be some Devel::* modules or some other trickery that could prevent inlining from the outside, but I'm currently unaware of any such modules, though I would be interested to learn about such things.)
In reply to Re: How to redefine a modules private function?
by haukex
in thread How to redefine a modules private function?
by sectokia
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |