Login
Tweak to P:C::Utils::is_class_name to filter out chained method calls, such as:
authorJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Fri, 13 Apr 2007 06:41:28 +0000 (06:41 +0000)
committerJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Fri, 13 Apr 2007 06:41:28 +0000 (06:41 +0000)
  $foo->bar->baz();

This helped resolve one of the failing tests in StricterSubs.

lib/Perl/Critic/Utils.pm

index cb58281..97fa846 100644 (file)
@@ -644,7 +644,8 @@ sub is_class_name {
     my $elem = shift;
     return if !$elem;
 
-    return _is_dereference_operator( $elem->snext_sibling() );
+    return _is_dereference_operator( $elem->snext_sibling() )
+        && !_is_dereference_operator( $elem->sprevious_sibling() );
 }
 
 #-----------------------------------------------------------------------------