Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to redefine a modules private function?

by salva (Canon)
on Mar 10, 2022 at 08:37 UTC ( [id://11141972]=note: print w/replies, xml ) Need Help??


in reply to How to redefine a modules private function?

Well, after seen all the solutions proposed, the truth is that I would go for the simplest one:

Just copy AnyEvent/DNS.pm from the AnyEvent distribution somewhere under your source tree (for instance, under a directory called patched_modules), make the required modifications there and then ensure it is in the module search path before the original:

BEGIN { unshift @INC, './patched_modules' } use AnyEvent; use AnyEvent::DNS;

I would also add a version check into my modified version of AnyEvent::DNS:

AnyEvent::VERSION eq "7.17" or warn "New version of AnyEvent ($AnyEvent::VERSION) detected, please +upgrade ".__FILE__." accordingly";

Replies are listed 'Best First'.
Re^2: How to redefine a modules private function?
by LanX (Saint) on Mar 10, 2022 at 10:50 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2024-04-18 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found