Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: adq [...] rosdev.org.uk
Cc:
AdminCc:

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



Subject: perl-tidy doesn't tidy long lines
Date: Mon, 10 Dec 2012 14:46:46 +0000
To: bug-Perl-Tidy [...] rt.cpan.org
From: Andrew de Quincey <adq [...] rosdev.org.uk>
Hi, I have several hundred perl files that have been "optimised" by removing all comments and newlines (though leaving variable names intact)... They look something like this: #!/usr/local/bin/perl # generic file comment ... the "..." is a single 6000+ character line of perl source. Perl::Tidy just outputs exactly the same as the input. If I manually add a few newlines in to break up the 6000+ chars, it suddenly starts formatting it properly. Is this an internal line length limit in Perl::Tidy?
Hi, I haven't been able to reproduce this with the default settings. I tried on test files up to 17,000 lines long, all condensed to a single line, with or without the two leading comments. I don't know of any buffer limit that would cause it. Maybe a system limit? I tested on linux with perl 5.10. You can send me a test file if it's not proprietary, at perltidy at users.sourceforge.net, along with any paramters. Steve
Subject: Re: [rt.cpan.org #81866] perl-tidy doesn't tidy long lines
Date: Mon, 10 Dec 2012 16:19:05 +0000
To: bug-Perl-Tidy [...] rt.cpan.org
From: Andrew de Quincey <adq [...] rosdev.org.uk>
Hi, the following is enough to stop it reformatting it... I'm not sure precisely what is the cause, but it sounds like its not a line length issue! #!/usr/local/bin/perl my $USAGE = "test.pl"; BEGIN { use vars qw($XXXXXXXXXXX $VERSION $YYYYYYY $YYYYYYYY); $0 =~ /^(?:(.*[\\\/])([s]?bin)[\\\/])?(.*)$/; print 'hi'; } On Mon, Dec 10, 2012 at 3:44 PM, Steve Hancock via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81866 > > > Hi, > I haven't been able to reproduce this with the default settings. I tried > on test files up to 17,000 lines long, all condensed to a single line, > with or without the two leading comments. I don't know of any buffer > limit that would cause it. Maybe a system limit? I tested on linux with > perl 5.10. You can send me a test file if it's not proprietary, at > perltidy at users.sourceforge.net, along with any paramters. > Steve >
Thanks, that clarifies the problem. I'll look into it. Steve
The solution is to use -npvl. What's going on is that in order to allow MakeMaker operate on perl scripts, perltidy will by default keep a line containing $VERSION intact, unless -npvl is set (see manual). In this case the entire script was in that line. The test for $VERSION is just a simple pattern match, and in this case it wasn't appropriate because it was inside a qw quote. I'll work on improving it for the next release. Steve
Subject: Re: [rt.cpan.org #81866] perl-tidy doesn't tidy long lines
Date: Tue, 11 Dec 2012 22:51:17 +0000
To: bug-Perl-Tidy [...] rt.cpan.org
From: Andrew de Quincey <adq [...] rosdev.org.uk>
fantastic thanks! On Mon, Dec 10, 2012 at 11:35 PM, Steve Hancock via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81866 > > > The solution is to use -npvl. What's going on is that in order to allow > MakeMaker operate on perl scripts, perltidy will by default keep a line > containing $VERSION intact, unless -npvl is set (see manual). In this > case the entire script was in that line. The test for $VERSION is just a > simple pattern match, and in this case it wasn't appropriate because it > was inside a qw quote. I'll work on improving it for the next release. > Steve >
Version 20140711 has a check to prevent this problem.