Skip Menu |

This queue is for tickets about the Perl-Tidy CPAN distribution.

Report information
The Basics
Id: 128265
Status: resolved
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: jidanni [...] jidanni.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 20180220
Fixed in: (no value)



Subject: Mention how to make one line block candidates become one line
Sorry, on the man page I can't find the switch that turns if ( $? == -1 ) { die "failed to execute: $!\n"; } into if ( $? == -1 ) { die "failed to execute: $!\n"; } while leaving multi-liners, if ( $? == -1 ) { print "Had enough.\n"; die "failed to execute: $!\n"; } alone. (Yes, subject to line length restrictions. But at least make it work for the short lines above.) (Maybe there is no example given and its control is merely described, thus hard to find on the man page.) Looked for half an hour. Lots of similar things, tried them, not what I want.
Although there is currently no flag to form one-line blocks from multiple-line blocks, a simple workaround is to execute perltidy twice, once with the flag B<-noadd-newlines> and then once again with normal parameters, like this: cat infile | perltidy -nanl | perltidy >outfile When executed on this snippet if ( $? == -1 ) { die "failed to execute: $!\n"; } if ( $? == -1 ) { print "Had enough.\n"; die "failed to execute: $!\n"; } the result is if ( $? == -1 ) { die "failed to execute: $!\n"; } if ( $? == -1 ) { print "Had enough.\n"; die "failed to execute: $!\n"; } This shows that blocks with a single statement become one-line blocks.