像Lint的Perl程序? [英] Lint-like program for Perl?

查看:75
本文介绍了像Lint的Perl程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Perl寻找皮棉,这会导致死代码和其他潜在问题.有什么建议吗?

I'm looking for a lint for Perl, something that would catch dead code and other potential problems. Any suggestions?

我有

use strict;
use warnings;

已经,但我想拥有更多.

already but I'd like to have more.

推荐答案

Perl没有直接等同于lint的功能.造成这种情况的很大一部分原因是Perl没有像C那样提供太多的挂起自己的方法. Perl的"lint"的基本版本是这样的:

Perl doesn't have a direct equivalent to lint. A large part of the reason for that is that Perl doesn't provide quite as many ways to hang yourself as C does. The basic version of "lint" for Perl is this:

perl -Mstrict [-Mdiagnostics] -cw <file>

这会使perl在打开安全性和警告的情况下编译(但不运行)指定的文件.如果您想要更多详细的消息,则可以使用诊断;如果简洁的消息足以满足您的需要,则可以不使用它.

This causes perl to compile (but not run) the specified file with strictures and warnings turned on. You can use diagnostics if you want more verbose messages or leave it out if the terse ones are enough for you.

如果您想要更多信息,请尝试使用 Perl :: Critic ,但请注意,这不是'也不是真正的皮棉. lint主要与错误有关(例如会阻止编译,触发运行时错误,不可移植,依赖未定义行为等的事物). Perl :: Critic更侧重于编码标准的实施.尽管存在一些重叠,但是它们是完全不同的.

If you want something more try using Perl::Critic, but be aware that this isn't really lint, either. lint primarily concerns itself with errors (e.g. things that would prevent compilation, trigger runtime errors, be non-portable, rely on undefined behavior, etc.). Perl::Critic is more focused on enforcement of coding standards. While there is some overlap they're very different things.

这篇关于像Lint的Perl程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆