How do I get perl -c to throw Undefined or Undeclared function errors?

前端 未结 4 1209
陌清茗
陌清茗 2020-12-09 20:09

Coming from a C++ background, I religiously use the use strict and use warnings features of Perl:

#!/usr/bin/perl -w
use strict;
us         


        
4条回答
  •  萌比男神i
    2020-12-09 20:43

    Seeing ikegami's Answer reminded me that perlcritic can identify undeclared subs, but you need to install the Perl::Critic::StricterSubs policy, which is not part of the core Perl::Critic distribution.

    perlcritic -4 mycode.pl

    Subroutine "foobar" is neither declared nor explicitly imported at line 10, column 1. This might be a major bug. (Severity: 4)

提交回复
热议问题