我的 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 中是否有可能导致此问题的内容?我似乎找不到任何东西来解释它。

最佳答案

文档在 Styles section 中说



(我的重点) 相关标志在 I/O control section 中有描述。

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

我发现 -nst ( --nostandard-ouput ) 甚至在 -pbp 之后也能在同一行上工作。

关于Perltidy 总是打印到标准输出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54229423/

10-11 06:30