Hi Jeffery,
For our purposes, it would be better to have the same complexity limit
as the subroutines. We would like the complexity evaluation to be as
consistent as possible.
I agree with you completely on the modulina pattern. Unfortunately we
have a lot of legacy code that is not written is this manner. We are
using complexity as one of our criteria for selecting code to refactor
first.
Thanks,
Ken
Show quoted text-----Original Message-----
From: Jeffrey Thalhammer via RT [mailto:bug-Perl-Critic@rt.cpan.org]
Sent: Sunday, February 04, 2007 5:33 PM
To: Ken Schafer
Subject: [rt.cpan.org #24699] The Perl Critic complexity module only
evaluates code contained in a subroutine
<URL:
http://rt.cpan.org/Ticket/Display.html?id=24699 >
Great suggestion. Do you think it should use the same complexity
limit as the subroutines? Or should there be a separate limit for non-
subroutine code?
BTW: I really like Brian Foy's modulina pattern. That way, you never
have more than one (real) line of code that is not in a subroutine.
And it makes it easy to test the subroutines in your scripts. For
example:
package Foo;
use strict;
use warnings;
use Bar::Baz;
exit run() if not caller;
sub run{
#everything happens in here
#return 0 on success, >0 on error
my $frob = frobulate( @ARGV );
$frob->fornicate( 42 );
#yadda ... yadda
}