Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^3: Help to override Spreadsheet/ParseXLSX.pm module (monkey-patching)by LanX (Saint) |
on Apr 03, 2021 at 12:42 UTC ( [id://11130772]=note: print w/replies, xml ) | Need Help?? |
It's not clear to me how you did the "sub-classing", by inheriting methods or by importing or a do or ...? Anyway, as I already said, I prefer monkey-patching over subclassing and you won't need to create another module/namespace for it. Sub-classing requires that the author played by "the" book, and the OOP book is indeed a TIMTOWTDI library in Perl. Monkey-patching OTOH is well defined and has no dependency to any OOP model. So in our own interest consider
And all patches will disappear outside this function. For completeness: Both ways may fail if there are any lexical variables closed over the patched subs, but even this can be solved with PadWalker, iff this really happens.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|