NAME

TooMuchCode::ProhibitDuplicateSub

DESCRIPTION

This policy checks if there are subroutine definitions with idential names in the same document. If they exists, all except for the last one are marked as violation.

perl runtime allows a named subroutine to be redefined in the same source file and the latest definition wins. In the event that this is done by developers, preferrably unintentionally, perl runtime (when <C>warnings</C> pragma is in place) warns that a subroutine is redefined, but the position is for the one that wins. This policy does the opposite.

Although the last one is not marked as a violation, it's position is reported together. Making it easier for developer to locate the subroutine.

Should the developer decide to programatically remove the duplicates, simply go through all the violations and remove those statements.