in reply to Perl::Critic policy for common Log::Log4perl mistake

How would Perl::Critic find out that @super_long_array is in fact a super long array? Note that the negative impact is only when the error message is really long and takes ages to expand. In the normal case warnings or error messages would be relatively short and the impact nonexistant.

  • Comment on Re: Perl::Critic policy for common Log::Log4perl mistake

Replies are listed 'Best First'.
Re^2: Perl::Critic policy for common Log::Log4perl mistake
by andreas1234567 (Vicar) on Nov 08, 2011 at 13:35 UTC
    Perl::Critic is a static code analyzer and can of course, by definition, not know the runtime length of arrays.

    The intention is to create Perl::Critic policy to help track down all logging calls, and then based on the output, help identify which ones are likely to have a negative impact on performance.

    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

      I first wanted to reply that this would be nonsense because nobody puts big arrays into error logs (and I still stand by that). A perl_critic rule that produces 99% false positives is not a good perl_critic rule. But then it occured to me that debug-logs might have such calls more frequently.

      So you got a point, but only in so far as logging level 'debug' is concerned. You might flag all calls to debug that don't have such a if-clause and you actually would have a somewhat sensible rule IMO.