in reply to Re: Assessing the complexity of regular expressions
in thread Assessing the complexity of regular expressions

I think the people who use Perl::Critic see some value in it. They've already answered this question of why. Among them, if they find that this particular policy stifles their creativity or fails to add value, they can turn it off either globally or for special occasions. For the ones who want it, I want to make it for them the best that I can.

(As an aside, I wonder if you would say the same thing of a large subroutine. Say it has too many lines or too many levels of indention, or what-have-you. Is there any gain to chunking it out to multiple subroutines (as an analog to moving parts of the regexp into variables and constructing the whole from parts)? Is it worth formatting it and commenting it?)

  • Comment on Re^2: Assessing the complexity of regular expressions

Replies are listed 'Best First'.
Re^3: Assessing the complexity of regular expressions
by Jenda (Abbot) on Jan 28, 2009 at 20:17 UTC

    I'm not asking why Perl::Critic. I'm asking why this policy. If you've got a subroutine that's too long/indented, you can split it, give some parts their own name and you end up with something that's better than the original. For some definitions of better.

    Doing the same with a regexp is most often either impossible, complicates the code or most of the proposed implementation of this policy would not even notice you've made any change. Perl::Critic should point out places you should probably change, there's no point in pointing out things you can't change.