This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a remaining B::Lint bug.
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 26 May 2002 21:01:35 +0000 (21:01 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 26 May 2002 21:01:35 +0000 (21:01 +0000)
p4raw-id: //depot/perl@16806

ext/B/B/Lint.pm
ext/B/t/lint.t

index cb15b79..9a977c8 100644 (file)
@@ -250,6 +250,11 @@ sub B::SVOP::lint {
            if ($gv->NAME =~ /^_./ && $gv->STASH->NAME ne $curstash) {
                warning('Illegal reference to private name %s', $gv->NAME);
            }
            if ($gv->NAME =~ /^_./ && $gv->STASH->NAME ne $curstash) {
                warning('Illegal reference to private name %s', $gv->NAME);
            }
+       } elsif ($opname eq "method_named") {
+           my $method = $op->gv->PV;
+           if ($method =~ /^_./) {
+               warning("Illegal reference to private method name $method");
+           }
        }
     }
     if ($check{undefined_subs}) {
        }
     }
     if ($check{undefined_subs}) {
index 6f21eaf..7be86ac 100644 (file)
@@ -63,13 +63,10 @@ RESULT
 Illegal reference to private name _x at -e line 1
 RESULT
 
 Illegal reference to private name _x at -e line 1
 RESULT
 
-    {
-       local $TODO = q/doesn't catch methods/;
-       runlint 'private-names', 'sub A::_f{};A->_f()', <<'RESULT',
+    runlint 'private-names', 'sub A::_f{};A->_f()', <<'RESULT',
 Illegal reference to private method name _f at -e line 1
 RESULT
 Illegal reference to private method name _f at -e line 1
 RESULT
-       'private-names';
-    }
+    'private-names (method)';
 
     runlint 'undefined-subs', 'foo()', <<'RESULT';
 Undefined subroutine foo called at -e line 1
 
     runlint 'undefined-subs', 'foo()', <<'RESULT';
 Undefined subroutine foo called at -e line 1