in reply to Prototypes required even after mocking a sub

It would probably be better to just set no warnings 'prototype'; in the scope where you override the subroutine, than messing with the global __WARN__ handler which many applications already are using.

Replies are listed 'Best First'.
Re^2: Prototypes required even after mocking a sub
by stevieb (Canon) on Sep 21, 2018 at 20:39 UTC

    I really don't like using sig handlers on a large scale for the reason you stated. I try to limit scope as best as possible.

    The no warnings 'prototype'; is one that I didn't come across (I'll be honest, I didn't dig deep enough). I can make that user-selectable, so that users have to turn that off explicitly so there's no confusion (barf first, re-read docs, then disable).

    That said, I'm still uncertain how this works. I desire to know *why* the prototypes exist after I've over-written the symtab entry for the subroutine.

      The specific warning you're talking about here is emitted when you override the sub with a different prototype. https://perldoc.pl/perldiag#Prototype-mismatch:-%25s-vs-%25s (making this a link does not work on this dumb website.)

        I completely understand why the warning is emitted; I'm looking for answers as to how perl knows about the overwrite, considering the fact I've overwritten the symtab entry for it.

        ps. This "dumb" website does links just fine.