http://www.perlmonks.org?node_id=395829


in reply to Translate debug code to a debugging technique

You could call cluck() conditionally based on the value of $^D. Something as simple as ( $^D || cluck() ) may suffice.

See both perlrun and perldebug for a number of gotchas with this method.

Regards,

PN5