Skip Menu |

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

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

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

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



Subject: Anonymous subs content indented incorrectly
Here is the example: my $aaa = { # OK bool => sub { my $self = shift; return; }, '|' => sub { my $self = shift; return; }, }; use overload # ERROR bool => sub { my $self = shift; return; }, '|' => sub { my $self = shift; return; };
Subject: Re: [rt.cpan.org #97204] Anonymous subs content indented incorrectly
Date: Mon, 14 Jul 2014 07:52:57 -0700
To: "bug-Perl-Tidy [...] rt.cpan.org" <bug-Perl-Tidy [...] rt.cpan.org>
From: Steven Hancock <perltidy [...] users.sourceforge.net>
Hi, I can't reproduce this; I would need the input file, version number and parameters. Thanks, Steve On Mon, Jul 14, 2014 at 4:46 AM, Dmytro Zagashev via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Mon Jul 14 07:46:08 2014: Request 97204 was acted upon. > Transaction: Ticket created by ZDM > Queue: Perl-Tidy > Subject: Anonymous subs content indented incorrectly > Broken in: 20140711 > Severity: Unimportant > Owner: Nobody > Requestors: ZDM@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=97204 > > > > Here is the example: > > my $aaa = { # OK > bool => sub { > my $self = shift; > > return; > }, > '|' => sub { > my $self = shift; > > return; > }, > }; > > use overload # ERROR > bool => sub { > my $self = shift; > > return; > }, > '|' => sub { > my $self = shift; > > return; > }; >
Subject: Re: [rt.cpan.org #97204] Anonymous subs content indented incorrectly
Date: Mon, 14 Jul 2014 23:43:40 +0300
To: bug-Perl-Tidy [...] rt.cpan.org
From: "dzagashev [...] gmail.com" <dzagashev [...] gmail.com>
options used: --perl-best-practices --tight-secret-operators --maximum-line-length=0 source for tests attached On 14.07.2014 17:53, Steve Hancock via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=97204 > > > Hi, I can't reproduce this; I would need the input file, version number and > parameters. > Thanks, > Steve > > > On Mon, Jul 14, 2014 at 4:46 AM, Dmytro Zagashev via RT < > bug-Perl-Tidy@rt.cpan.org> wrote: >
>> Mon Jul 14 07:46:08 2014: Request 97204 was acted upon. >> Transaction: Ticket created by ZDM >> Queue: Perl-Tidy >> Subject: Anonymous subs content indented incorrectly >> Broken in: 20140711 >> Severity: Unimportant >> Owner: Nobody >> Requestors: ZDM@cpan.org >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=97204 > >> >> >> Here is the example: >> >> my $aaa = { # OK >> bool => sub { >> my $self = shift; >> >> return; >> }, >> '|' => sub { >> my $self = shift; >> >> return; >> }, >> }; >> >> use overload # ERROR >> bool => sub { >> my $self = shift; >> >> return; >> }, >> '|' => sub { >> my $self = shift; >> >> return; >> }; >>

Message body is not shown because sender requested not to inline it.

The undesirable formatting is caused by -pbp, which unfortunately sets both -ci=4 and -i=4. You can use -pbp -ci=2 to avoid this. The following example is from the manual description of -pbp: Also note that the value of continuation indentation, -ci=4, is equal to the value of the full indentation, -i=4. In some complex statements perltidy will produce nicer results with -ci=2. This can be implemented by including -ci=2 after the -pbp parameter. For example, # perltidy -pbp $self->{_text} = ( !$section ? '' : $type eq 'item' ? "the $section entry" : "the section on $section" ) . ( $page ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage" : ' elsewhere in this document' ); # perltidy -pbp -ci=2 $self->{_text} = ( !$section ? '' : $type eq 'item' ? "the $section entry" : "the section on $section" ) . ( $page ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage" : ' elsewhere in this document' );