From: Malcolm Beattie Date: Wed, 3 Sep 1997 13:41:20 +0000 (+0000) Subject: Let Lint private_names catch out-of-package _foo methods. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d325ce78279a9da86468f175ebf8f1ec7617548;p=p5sagit%2Fp5-mst-13.2.git Let Lint private_names catch out-of-package _foo methods. p4raw-id: //depot/perlext/Compiler@52 --- diff --git a/B/Lint.pm b/B/Lint.pm index 4e34545..3b4ea7e 100644 --- a/B/Lint.pm +++ b/B/Lint.pm @@ -183,6 +183,15 @@ sub B::UNOP::lint { warning("Implicit scalar context for %s in %s", $ppaddr eq "pp_rv2av" ? "array" : "hash", $parent->desc); } + if ($check{private_names} && $ppaddr eq "pp_method") { + my $methop = $op->first; + if ($methop->ppaddr eq "pp_const") { + my $method = $methop->sv->PV; + if ($method =~ /^_/ && !defined(&{"$curstash\::$method"})) { + warning("Illegal reference to private method name $method"); + } + } + } } sub B::PMOP::lint {