in reply to Re^2: sub BEGIN
in thread sub BEGIN
From my perspective, BEGIN blocks are a form of code smell. In this case, a variation on 'Inappropriate intimacy'.
Several possibilities for a fix stand out:
What if the required module calls the overridden method within its own BEGIN block?
Once you start the arms race of every programmer putting the bits of their code they think are of paramount importance in BEGIN blocks, soon everybody will be putting everything in BEGIN blocks, and you're back to square one with no solution.
But the most interesting question here I think would be: why are you poking around in there anyway?
That is, what led you in there? What are you trying to do that you're failing to achieve? What error situation are you trying to avoid? What is it that you're really asking for help with?
If this is just an academic exercise of trying to improve your Perl by reading and understanding the internals of some examples, on the basis of what you've posted in isolation, you'd better pick some better examples.
|
|---|