Skip Menu |
 

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

Report information
The Basics
Id: 130640
Status: open
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: violapiratejunky [...] gmail.com
Cc:
AdminCc:

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



Subject: Allow different subroutine keywords
Download (untitled) / with headers
text/plain 538b
When using something like Function::Parameters, subroutines like these: method get_value () { } fun get_other_value () { } Become: method get_value() { } fun get_other_value() { } Even though sub with a subroutine signature is left with the space before the parentheses: sub get_value () { } It would be nice if there was support for other subroutine keywords that could behave like sub. The two above are specific to Function::Parameters, so maybe there could be a config option to pass other allowed subroutine keywords?
Subject: Re: [rt.cpan.org #130640] Allow different subroutine keywords
Date: Mon, 7 Oct 2019 09:06:24 -0700
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <perltidy [...] users.sourceforge.net>
Download (untitled) / with headers
text/plain 1.3k
Hi Adam, Sorry for the delay in responding, I've been away. I'll look at this. I noticed that using -sfp will force the space in these examples, but that's not a solution because it would also put spaces for actual function calls. So some kind of new flag is needed, or at least it could follow the input as an example. Thanks, Steve On Wed, Oct 2, 2019 at 9:58 PM Adam Hopkins via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Thu Oct 03 00:58:07 2019: Request 130640 was acted upon. > Transaction: Ticket created by srchulo > Queue: Perl-Tidy > Subject: Allow different subroutine keywords > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: violapiratejunky@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=130640 > > > > When using something like Function::Parameters, subroutines like these: > > method get_value () { > > } > > fun get_other_value () { > > } > > Become: > > > method get_value() { > > } > > fun get_other_value() { > > } > > Even though sub with a subroutine signature is left with the space before > the parentheses: > > sub get_value () { > > } > > It would be nice if there was support for other subroutine keywords that > could behave like sub. The two above are specific to Function::Parameters, > so maybe there could be a config option to pass other allowed subroutine > keywords? > > >
Download (untitled) / with headers
text/plain 1.5k
Thanks for the response! That makes sense. On Mon Oct 07 12:06:43 2019, SHANCOCK wrote: Show quoted text
> Hi Adam, > Sorry for the delay in responding, I've been away. I'll look at this. > > I noticed that using -sfp will force the space in these examples, but > that's not a solution because it would > also put spaces for actual function calls. So some kind of new flag is > needed, or at least it could follow the > input as an example. > > Thanks, > Steve > > On Wed, Oct 2, 2019 at 9:58 PM Adam Hopkins via RT < > bug-Perl-Tidy@rt.cpan.org> wrote: >
> > Thu Oct 03 00:58:07 2019: Request 130640 was acted upon. > > Transaction: Ticket created by srchulo > > Queue: Perl-Tidy > > Subject: Allow different subroutine keywords > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: violapiratejunky@gmail.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=130640 > > > > > > > When using something like Function::Parameters, subroutines like these: > > > > method get_value () { > > > > } > > > > fun get_other_value () { > > > > } > > > > Become: > > > > > > method get_value() { > > > > } > > > > fun get_other_value() { > > > > } > > > > Even though sub with a subroutine signature is left with the space before > > the parentheses: > > > > sub get_value () { > > > > } > > > > It would be nice if there was support for other subroutine keywords that > > could behave like sub. The two above are specific to Function::Parameters, > > so maybe there could be a config option to pass other allowed subroutine > > keywords? > > > > > >
Download (untitled) / with headers
text/plain 954b
I have written an update for this which will be in the next release. Here is the brief description from the Change Log: - Implement issue RT#130640: Allow different subroutine keywords. Added a flag --sub-alias-list=s or -sal=s, where s is a string with one or more aliases for 'sub', separated by spaces or commas. For example, perltidy -sal='method fun' will cause the perltidy to treat the words 'method' and 'fun' to be treated the same as if they were 'sub'. - Added flag --space-prototype-paren=i, or -spp=i, to control spacing before the opening paren of a prototype, where i=0, 1, or 2: i=0 no space i=1 follow input [current and default] i=2 always space Previously, perltidy always followed the input. For example, given the following input sub usage(); The result will be: sub usage(); # i=0 [no space] sub usage(); # i=1 [default; follows input] sub usage (); # i=2 [space]
Those look great! Thank you for the update :) On Tue Oct 15 08:22:11 2019, SHANCOCK wrote: Show quoted text
> > > I have written an update for this which will be in the next release. > Here is the brief description from the Change Log: > > - Implement issue RT#130640: Allow different subroutine keywords. > Added a flag --sub-alias-list=s or -sal=s, where s is a string with > one or more aliases for 'sub', separated by spaces or commas. > For example, > > perltidy -sal='method fun' > > will cause the perltidy to treat the words 'method' and 'fun' to be > treated the same as if they were 'sub'. > > - Added flag --space-prototype-paren=i, or -spp=i, to control spacing > before the opening paren of a prototype, where i=0, 1, or 2: > i=0 no space > i=1 follow input [current and default] > i=2 always space > > Previously, perltidy always followed the input. > For example, given the following input > > sub usage(); > > The result will be: > sub usage(); # i=0 [no space] > sub usage(); # i=1 [default; follows input] > sub usage (); # i=2 [space]


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.