3

我的Perltidy总是打印到标准输出而不是默认值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. 我可以让它转到另一个文件的唯一方法是:

perltidy test.pl > test.pl.tdy

我身上有什么东西.perltidyrc可能导致这种情况吗?我似乎找不到任何可以解释的东西。

4

1 回答 1

5

文档在样式部分中说

-pbp, --perl-best-practices
-pbp 是 Damian Conway 的 Perl Best Practices 一书中参数的缩写:

-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来覆盖。

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

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

我发现-nst( --nostandard-ouput) 甚至在同一行的 ,之后也有效。-pbp

于 2019-01-17T05:43:13.633 回答