|Problems? Is your data what you think it is?|
Overridding subroutines called in private subroutinesby skazat (Hermit)
|on Oct 05, 2008 at 02:55 UTC||Need Help??|
skazat has asked for the
wisdom of the Perl Monks concerning the following question:
I'm currently scratching my head whilst using the MIME::Lite::HTML module. The module itself is kind of showing it's age.
I'm attempting to override the, "absUrl" method, which isn't really a method at all - but just a subroutine in the module itself. No problem, I thought - those can still be overridden, if I do this:
I can then do this,
Which prints out, "PONIES!"; But, using the, public interface, my overridden absURL never takes effect. (No ponies for me)
The only way I can get it to do what I want to do is to have something like:
in my code - which I don't think is valid Perl code (works alright in all, though)
The only weirdness I can find in this module is that the absUrl subroutine is only called in MIME::Lite::HTML itself in private subroutines of the, "parse" method, like this:
which is bizarre.
I can successfully override both the, "parse" and, "absUrl" method/subroutines and have the thingy do what I want, but why can't just absUrl be overridden?
Is it something I'm missing about this subroutine not being in the @EXPORT or, @EXPORT_OK list? Or is it a weird thing about private subroutines in a public method, which cannot be overridden?
I was under the impression that you can't really privatize a Perl method's subroutine or method completely.
It has to be said that the subroutine, "absURL" isn't in the docs public or private methods - it's not in the docs at all. Can anyone think of a need to have private subroutines within a method?
And just to throw this out there, I know this module hasn't been updated in years and it's quirkiness keeps costing me hours. I'll throw up my hand to take over maintenance of the module (there are, perhaps better alternatives right now, but the dependency chain scares me) - how'd I go about doin' that? I'd like to simple clean up the externals of this module a bit, so people can successfully subclass the module to fix the niggling bugs that people like myself are hitting (and then, hopefully apply patches to fix up them for real)