Class-Sniff
view release on metacpan or search on metacpan
lib/Class/Sniff.pm view on Meta::CPAN
my $method_length = $end_line - $start_line;
The C<$start_line> returns the line number of the I<first expression> in the
subroutine, not the C<sub foo { ...> declaration. The subroutine's
declaration actually ends at the ending curly brace, so the following method
would be considered 3 lines long, even though you might count it differently:
sub new {
# this is our constructor
my ( $class, $arg_for ) = @_;
my $self = bless {} => $class;
return $self;
}
=cut
sub long_methods { %{ $_[0]->{long_methods} } }
=item * Exported methods
These are simply ignored because the C<B> modules think they start and end in
t/code_smells.t view on Meta::CPAN
sub new {
my ( $class, $arg_for ) = @_;
#
# Forcing this to be a long method to force a 'long method' report
#
#
#
#
#
#
my $self = bless {} => $class;
return $self;
}
sub foo { }
sub bar { }
sub baz { }
package Child1;
our @ISA = 'Abstract';
use Carp 'croak';
( run in 0.241 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )