Perl::Tidy parses and beautifies Perl source code.
Questions tagged [perl-tidy]
35 questions
18
votes
4 answers
Perl::Critic: Life after Moose?
I've started a conversion of a project to Moose and the first thing I noticed was that my critic/tidy tests go to hell. Moose, Tidy and Critic don't seem to like each other as much as they used to.
Are there docs anywhere on how to make critic/tidy…
![](../../users/profiles/91911.webp)
claco
- 751
- 1
- 8
- 17
16
votes
5 answers
How can I automatically tidy up Perl source code?
A cat at my company walked over a keyboard and has left a valid 1000+ line of executable Perl code for me to maintain.
Thanks to Perl's TMTOWTDI philosophy I find myself searching Google to make sense of every line of code she has produced.
To add…
![](../../users/profiles/38306.webp)
Ankur Gupta
- 2,276
- 4
- 27
- 40
12
votes
4 answers
How can I make perltidy work with Method::Signatures?
I'm using Eclipse combined with EPIC to write my Perl code. I configured EPIC to use Perltidy with "-pbp" (perl best practices style) to format my code.
This doesn't work well when using Method::Signatures' named parameters. E.g., func (:$arg1, :…
![](../../users/profiles/377031.webp)
David B
- 26,728
- 46
- 126
- 177
11
votes
1 answer
Configuring Perl::Tidy to handle custom keywords
Is there a straightforward way to configure Perl::Tidy so that it handles correctly custom keywords created with Devel::Declare?
Specifically, I am using Sub::Curried, which creates a keyword curry that works more or less like sub with method…
![](../../users/profiles/2025742.webp)
scozy
- 2,411
- 15
- 34
10
votes
2 answers
Perltidy autoformat hashref as parameter
I have the following code snippet:
my $obj = $class->new({
schema => $schema,
reminder => $reminder,
action => $action,
dt => $dt,
});
My problem is, that perltidy tries to format it into something, like this:
my…
![](../../users/profiles/1332321.webp)
Davs
- 495
- 4
- 11
7
votes
2 answers
How can I prevent PerlTidy from aligning assignments but keep adding single spaces?
How can I prevent PerlTidy from aligning assignments but keep adding single spaces?
This question is similar to How can I prevent PerlTidy from aligning my assignments? but I would like single spaces to be added where directed. Due to this -naws…
![](../../users/profiles/33608.webp)
agsamek
- 7,574
- 11
- 34
- 42
7
votes
1 answer
How to apply/use Perl::Tidy with an existing Perl project?
This question is not so much technical than looking for advise to find the proper approach that will not hurt.
Assuming the following:
We have a big application developed in Perl.
We want to start using perltidy on the commandline to impose…
![](../../users/profiles/92795.webp)
Беров
- 1,335
- 10
- 22
6
votes
3 answers
perltidy formatting complex if
How can I configure perltidy to format long if statements like this:
if (
('this is an example' =~ /an.*example/ and 1 * 2 * 3 == 6) or
('hello world' =~ /world/ and 6 = 3 * 2 * 1)
) {
print "hello\n";
}
or like this
if (
('this is…
![](../../users/profiles/599686.webp)
bliof
- 2,842
- 1
- 20
- 36
5
votes
1 answer
How can I prevent PerlTidy from aligning my assignments?
By default, PerlTidy will line up assignments in my code. E.g.
PerlTidy changes this...
my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;
...into this...
my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;
How do I prevent this…
![](../../users/profiles/278732.webp)
nick
- 1,189
- 10
- 28
5
votes
4 answers
How can we catch side comments using Perl::Tidy or Perl::Critic?
My department is currently settling on some general code best practices, which we would like to somewhat enforce, providing developers with Perl::Tidy and Perl::Critic configurations.
Now we are having problems with side comments. The side comment…
![](../../users/profiles/6460.webp)
Nikolai Prokoschenko
- 7,353
- 6
- 48
- 89
4
votes
1 answer
Convincing Perltidy to leave whitespace alone
I am using Perltidy to reformat a few of my old Perl files to a style that is closer to my current preferences. I encountered an issue with this snippet:
Fcntl::S_IRUSR & $mode
Perltidy insists on removing the space after the & token, resulting…
![](../../users/profiles/507519.webp)
thkala
- 76,870
- 21
- 145
- 185
4
votes
2 answers
Why is perltidy going to stdout?
I have a bash command, get-modified-perl-files, that returns all the Perl files I have modified in my repository. I would like to use perltidy on all of these files.
I created a bash function to do the job:
tidy() {
for f in…
![](../../users/profiles/7334162.webp)
Pierre
- 1,647
- 2
- 20
- 33
4
votes
1 answer
Perlcritic not recognising code that has been tidied
I'm using perlcritic with perltidy and while the other rules are applied, I'm, getting the following error message:
Code is not tidy at line 1, near 'package MyPackage;'.
I've run perltidy to tidy the code but I am still getting the problem. In the…
![](../../users/profiles/2255594.webp)
Geraint Anderson
- 2,526
- 3
- 21
- 43
4
votes
4 answers
Which is the closest Python equivalent to Perl::Tidy?
Coming from Perl I've been used to hitting C-c t to reformat my code according to pre-defined Perl::Tidy rules. Now, with Python I'm astonished to learn that there is nothing that even remotely resembles the power of Perl::Tidy. PythonTidy 1.20…
![](../../users/profiles/6460.webp)
Nikolai Prokoschenko
- 7,353
- 6
- 48
- 89
3
votes
1 answer
Perltidy always prints to standard out
My Perltidy always prints to standard out instead of the default test.pl.tdy:
perltidy test.pl
And here is my .perltidyrc:
-pbp # Start with Perl Best Practices
-w
-l=100 # 100 characters per line
-ce # 'cuddled' elses. elses appear on the same…
![](../../users/profiles/834140.webp)
srchulo
- 4,843
- 4
- 38
- 68