From: Steve Hancock Date: Sat, 24 Aug 2024 01:26:23 +0000 (-0700) Subject: update docs X-Git-Tag: 20240903~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d60809e013b2c4ef559728cf8d82baad1806d31f;p=perltidy.git update docs --- diff --git a/bin/perltidy b/bin/perltidy index 835a0f53..d8589048 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -6053,7 +6053,7 @@ This selects every if-chain which contains 2 or more B blocks: =back -=item B +=item B Variables with certain properties of interest to a programmer can be listed with B<--dump-unusual-variables> or B<-duv>. This parameter must be on @@ -6104,8 +6104,9 @@ similar to the B policy B. These are variables which have the same bareword name but a different sigil (B<$>, B<@>, or B<%>) as another variable in the same scope. For example, this -occurs if variables B<$data> and B<%data> share the same scope. This can be -confusing and can be avoided by renaming one of the variables. +occurs if variables B<$data> and B<%data> share the same scope. This can also +be confusing for the reasons mentioned above and can be avoided by renaming +one of the variables. =item B @@ -6169,7 +6170,8 @@ B<$VERSION>, B<@EXPORT>, B<@EXPORT_OK>, B<%EXPORT_TAGS>, B<@ISA, $AUTOLOAD>. =item B -The flag B<--warn-variable-types=string>, or B<-wvt=string>, can be used to +The flag B<--warn-variable-types=string>, or B<-wvt=string>, is the B<--warn> +counterpart to B<--dump-unusual-variables>, and can be used to produce a warning message if certain of the above variable types are encountered during formatting. All possible variable warnings may be requested with B<-wvt='*'> or B<-wvt=1>. @@ -6190,13 +6192,6 @@ types of variables to be checked. For example: will process F normally but issue a warning if either of the issues B or B, described above, are encountered. -The B and B options (unused variables and constants) have a limitation: -they may be silently turned off if perltidy detects that it is operating on -just part of a script. This logic is necessary to avoid warnings when perltidy -is run on small snippets of code from within an editor. These options are -never turned off if perltidy receives a B<-wvt> parameter on the command line -and is operating on a named file. - A companion flag, B<--warn-variable-exclusion-list=string>, or B<-wvxl=string>, can be used to skip warning checks for a list of variable names. A leading and/or trailing '*' may be placed on any of these variable names to allow a @@ -6204,11 +6199,28 @@ partial match. For example, - perltidy -wvt='*' -wvxl='$self $class *_unused' somefile.pl + perltidy -wvt=1 -wvxl='$self $class *_unused' somefile.pl will do all possible checks but not report any warnings for variables C<$self>, C<$class>, and for example C<$value_unused>. +This partial match option provides a way to trigger a warning message when a +new unused variable is detected in a script. This can be accomplished by +adding a unique suffix to the names of existing unused variables, such as +C<_unused>. This suffix is then added to the exclusion list. + +As a specific example, consider the following line which is part of some debug +code which only references the latter three variables (but might someday need +to reference the package variable too). + + my ( $package_uu, $filename, $line, $subroutine ) = caller(); + +The unused variable, C<$package_uu>, has been specially marked with suffix +C<_uu>. No type B (unused variable) warning will be produced provided that +this wildcard suffix is in the exclusion list: + + -wvxl='*_uu' + =item B The parameter B<--dump-mixed-call-parens>, or B<-dmcp>, provides information on