Perltidy 总是打印到标准输出 [英] Perltidy always prints to standard out

查看:115
本文介绍了Perltidy 总是打印到标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Perltidy 总是打印到标准输出而不是默认的 test.pl.tdy:

My Perltidy always prints to standard out instead of the default test.pl.tdy:

perltidy test.pl

这是我的.perltidyrc:

-pbp # Start with Perl Best Practices
-w
-l=100   # 100 characters per line
-ce # 'cuddled' elses. elses appear on the same line as last brace
-pt=2 # no parentheses spacing
-pt=2    # High parenthesis tightness
-bt=2    # High brace tightness
-sbt=2   # High square bracket tightness
-bar # opening braces right
-nsbl # open subroutine brace on right
-bbvt=1 # Block Brace Vertical Tightness
-sot # stack opening tokens
-sct # stack closing tokens
-nsfs # no For Loop Semicolon Spaces
-nolq # don't outdent long strings

即使我这样做:

perltidy -b test.pl

它仍然会打印到标准输出,而不是去test.pl.bak.我可以让它转到其他文件的唯一方法是执行以下操作:

It will still print to standard out and not go to test.pl.bak. The only way I can get it to go to a different file is by doing:

perltidy test.pl > test.pl.tdy

我的 .perltidyrc 中是否有可能导致此问题的内容?我似乎找不到任何东西来解释它.

Is there something in my .perltidyrc that could be causing this? I can't seem to find anything to explain it.

推荐答案

文档在 Styles 部分说

-pbp、--perl-最佳实践
-pbp 是 Damian Conway 所著《Perl Best Practices》一书中参数的缩写:

-pbp, --perl-best-practices
-pbp is an abbreviation for the parameters in the book Perl Best Practices by Damian Conway:

-l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
-wbb="% + - * / x != == >= <= =~ !~ < > | & =
      **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x="

请注意,此参数集包括 -st 和 -se 标志,这使得 perltidy 仅作为一个文件的过滤器.这些可以通过在 -pbp 参数之后放置 -nst 和/或 -nse 来覆盖.

Please note that this parameter set includes -st and -se flags, which make perltidy act as a filter on one file only. These can be overridden by placing -nst and/or -nse after the -pbp parameter.

(我的重点) I/O 控制部分中描述了相关标志.

(my emphasis)   The relevant flags are described in I/O control section.

我不知道为什么 -pbp 包含打印到标准流的标志,这意味着必须只有一个输入文件,但可能是有原因的;因此,详细检查其下的所有标志的作用可能是个好主意.

I don't know why -pbp includes the flags to print to standard streams, which imply that there must be only one input file, but there may be a reason; so it may be a good idea to inspect in detail what all those flags under it do.

我发现 -nst (--nostandard-ouput) 在 -pbp 之后甚至正确工作, 在同一行.

I find that -nst (--nostandard-ouput) works even right after the -pbp, on the same line.

这篇关于Perltidy 总是打印到标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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