X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=docs%2Fperltidy.html;fp=docs%2Fperltidy.html;h=8087a23f82acdf0a49277f696bbc58116dc38ff8;hb=c514d57dc8088e1f4d3f51857b1155c20085c296;hp=dd4382895bd8fbe7d45e881b0333c034efafa8a7;hpb=880633cc084e9d787eb9f760d3851c5d660db17c;p=perltidy.git diff --git a/docs/perltidy.html b/docs/perltidy.html index dd43828..8087a23 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -71,7 +71,9 @@

DESCRIPTION

-

Perltidy reads a perl script and writes an indented, reformatted script.

+

Perltidy reads a perl script and writes an indented, reformatted script. This document describes the parameters available for controlling this formatting.

+ +

Perltidy is a commandline frontend to the module Perl::Tidy. For documentation describing how to call the Perl::Tidy module from other applications see the separate documentation for Perl::Tidy. It is the file Perl::Tidy.pod in the source distribution.

Many users will find enough information in "EXAMPLES" to get started. New users may benefit from the short tutorial which can be found at http://perltidy.sourceforge.net/tutorial.html

@@ -328,7 +330,7 @@
        perltidy -sal='method fun _sub M4'
-

will cause the perltidy to treate the words 'method', 'fun', '_sub' and 'M4' to be treated the same as if they were 'sub'. Note that if the alias words are separated by spaces then the string of words should be placed in quotes.

+

will cause the perltidy to treat the words 'method', 'fun', '_sub' and 'M4' the same as if they were 'sub'. Note that if the alias words are separated by spaces then the string of words should be placed in quotes.

Note that several other parameters accept a list of keywords, including 'sub' (see "Specifying Block Types"). You do not need to include any sub aliases in these lists. Just include keyword 'sub' if you wish, and all aliases are automatically included.

@@ -336,7 +338,7 @@
-gal=s, --grep-alias-list=s
-

This flag allows a code block following an external 'list operator' function to be formatted as if it followed one of the builtin keywords grep, map or sort. The string s contains the names of one or more such list operators, separated by spaces or commas.

+

This flag allows a code block following an external 'list operator' function to be formatted as if it followed one of the built-in keywords grep, map or sort. The string s contains the names of one or more such list operators, separated by spaces or commas.

By 'list operator' is meant a function which is invoked in the form

@@ -431,15 +433,15 @@
-et=n, --entab-leading-whitespace
-

This flag causes each n initial space characters to be replaced by one tab character.

+

This flag causes each n leading space characters produced by the formatting process to be replaced by one tab character. The formatting process itself works with space characters. The -et=n parameter is applied as a last step, after formatting is complete, to convert leading spaces into tabs. Before starting to use tabs, it is essential to first get the indentation controls set as desired without tabs, particularly the two parameters --indent-columns=n (or -i=n) and --continuation-indentation=n (or -ci=n).

-

The value of the integer n can be any value but can be coordinated with the number of spaces used for intentation. For example, -et=4 -ci=4 -i=4 will produce one tab for each indentation level and and one for each continuation indentation level. You may want to coordinate the value of n with what your display software assumes for the spacing of a tab.

+

The value of the integer n can be any value but can be coordinated with the number of spaces used for indentation. For example, -et=4 -ci=4 -i=4 will produce one tab for each indentation level and and one for each continuation indentation level. You may want to coordinate the value of n with what your display software assumes for the spacing of a tab.

-t, --tabs
-

This flag causes one leading tab character to be inserted for each level of indentation. Certain other features are incompatible with this option, and if these options are also given, then a warning message will be issued and this flag will be unset. One example is the -lp option. This flag is retained for backwards compatibility, but if you use tabs, the -et=n flag is recommended.

+

This flag causes one leading tab character to be inserted for each level of indentation. Certain other features are incompatible with this option, and if these options are also given, then a warning message will be issued and this flag will be unset. One example is the -lp option. This flag is retained for backwards compatibility, but if you use tabs, the -et=n flag is recommended. If both -t and -et=n are set, the -et=n is used.

-dt=n, --default-tabsize=n
@@ -488,7 +490,7 @@
-enc=s, --character-encoding=s
-

This flag indicates if the input data stream use a character encoding. Perltidy does not look for the encoding directives in the soure stream, such as use utf8, and instead relies on this flag to determine the encoding. (Note that perltidy often works on snippets of code rather than complete files so it cannot rely on use utf8 directives).

+

This flag indicates if the input data stream use a character encoding. Perltidy does not look for the encoding directives in the source stream, such as use utf8, and instead relies on this flag to determine the encoding. (Note that perltidy often works on snippets of code rather than complete files so it cannot rely on use utf8 directives).

The possible values for s are:

@@ -524,13 +526,21 @@
-eos=s, --encode-output-strings=s
-

This flag has been added to resolve an issue involving the interface between Perl::Tidy and calling programs, and in particular Code::TidyAll (tidyall). By default Perl::Tidy returns unencoded strings to the calling program, but some programs expect encoded strings. Setting this flag causes Perl::Tidy to return encoded output strings which it decoded. For some background information see https://github.com/perltidy/perltidy/issues/83 and https://github.com/houseabsolute/perl-code-tidyall/issues/84.

+

This flag was added to resolve an issue involving the interface between Perl::Tidy and calling programs, and in particular Code::TidyAll (tidyall).

+ +

If you only run the perltidy binary this flag has no effect. If you run a program which calls the Perl::Tidy module and receives a string in return, then the meaning of the flag is as follows:

-

If you only run the perltidy binary this flag has no effect.

+ + +

The default was changed from -neos to -eos in versions after 20220217. If this change causes a program to start running incorrectly on encoded files, an emergency fix might be to set -neos. Additional information can be found in the man pages for the Perl::Tidy module and also in https://github.com/perltidy/perltidy/blob/master/docs/eos_flag.md.

-gcs, --use-unicode-gcstring
@@ -644,7 +654,7 @@

By default, perltidy examines the input file and tries to determine the starting indentation level. While it is often zero, it may not be zero for a code snippet being sent from an editing session.

-

To guess the starting indentation level perltidy simply assumes that indentation scheme used to create the code snippet is the same as is being used for the current perltidy process. This is the only sensible guess that can be made. It should be correct if this is true, but otherwise it probably won't. For example, if the input script was written with -i=2 and the current peltidy flags have -i=4, the wrong initial indentation will be guessed for a code snippet which has non-zero initial indentation. Likewise, if an entabbing scheme is used in the input script and not in the current process then the guessed indentation will be wrong.

+

To guess the starting indentation level perltidy simply assumes that indentation scheme used to create the code snippet is the same as is being used for the current perltidy process. This is the only sensible guess that can be made. It should be correct if this is true, but otherwise it probably won't. For example, if the input script was written with -i=2 and the current perltidy flags have -i=4, the wrong initial indentation will be guessed for a code snippet which has non-zero initial indentation. Likewise, if an entabbing scheme is used in the input script and not in the current process then the guessed indentation will be wrong.

If the default method does not work correctly, or you want to change the starting level, use -sil=n, to force the starting level to be n.

@@ -674,7 +684,7 @@

These flags have no effect on code BLOCKS, such as if/then/else blocks, which always use whatever is specified with -i=n.

-

Some limitiations on these flags are:

+

Some limitations on these flags are: