in reply to Help trying to find a Perltidy option

I remember having seen it before, but reading through the man page fails to come up with anything.

perldoc perltidy |grep -i qw Trimming whitespace around "qw" quotes -tqw or --trim-qw provide the default behavior of trimming space +s around multi-line "qw" quotes and indenting them appropriately. -ntqw or --notrim-qw cause leading and trailing whitespace aroun +d multi-line "qw" quotes to be left unchanged. This option will no +t in some versions of perl, trimming "qw" quotes changes the synta +x ssc st sts syn t tac tbc toc tp tqw tsc w x bar k +is Perltidy indents but does not reformat comments and "qw" quotes.
The documentation says it only indents for multi-line qw, so there is no perltidy option for what you want

Replies are listed 'Best First'.
Re^2: Help trying to find a Perltidy option
by Anonymous Monk on Jun 11, 2010 at 11:34 UTC
    Here is a workaround, first use this one-liner to indent your use lines
    perl -pe " s/^use\s+(\S+)\s+(.+)$/sprintf q!use %-20s %s!, $1, $2/e; " + < input > output
    then tell perltidy ignore that section by surrounding it with #<<< and #>>> and you get
    #<<< do not let perltidy touch this use Carp qw(confess); use Cwd qw(abs_path); use File::Basename qw(fileparse); use Data::Dumper qw(); use Digest::SHA1 qw(); #>>>
Re^2: Help trying to find a Perltidy option
by Yary (Pilgrim) on Jun 11, 2010 at 19:23 UTC
    Do either "-wls=q" or "-wls=Q" work? They should insert white space before any qw block (first form) or any quote/pattern (second form). The only side effect is that it would be everwhere, not just after USE statements.

    edit: they don't work for this :-(