Seconding these recommendations. Log4perl overhead will be similar to your solution in the disabled case (a sub call immediately returning, which while negligible is something) and the flexibility it offers is well worth that. Smart::Comments on the other hand if not enabled are truly just comments with no overhead save skipping over during compilation (same as any other comment). The catch is that it uses mildly ebil source filtering to work so be aware (although I can’t offhand recall a time or two it ever caused problems nor actually enumerate what they were). Personally I’ve mostly moved to using l4p exclusively.
The cake is a lie.
The cake is a lie.
The cake is a lie.