NAME

perl-quote-fix - fix RequireConsistentQuoting violations in Perl source

VERSION

version v0.3.0

SYNOPSIS

perl-quote-fix [--lines START-END] < input.pl > output.pl
perl-quote-fix [--lines START-END] file ... > output.pl
perl-quote-fix --inplace file ...

Options:
  --lines START-END  only fix violations within this line range
  --inplace          fix the named files in place
  --help             show this help

DESCRIPTION

Reads Perl source on standard input, or from the named files, and writes it to standard output with all violations of Perl::Critic::Policy::ValuesAndExpressions::RequireConsistentQuoting fixed. Each named file is read explicitly and fixed as a separate document; an input which cannot be read is reported and the exit status is non-zero. The runtime value of every string is preserved; anything that cannot be fixed safely is left unchanged. Source that the policy already accepts passes through byte for byte.

With --lines, the whole document is still parsed but only violations starting within the inclusive line range are fixed. This suits editor integrations that format a selection.

With --inplace, the named files are fixed in place in a single process, which is much faster than one invocation per file. Files needing no fix are left untouched and file modes are preserved. Each file is replaced atomically via a temporary file in the same directory, so a failed write leaves the original untouched. A file which cannot be read or written is reported and the exit status is non-zero, but the remaining files are still fixed. --inplace cannot be combined with --lines.

The fixer does not tidy layout. Run perltidy afterwards if a fix has disturbed alignment.

AUTHOR

Paul Johnson <paul@pjcj.net>

LICENCE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.