Skip Menu |

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

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

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

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



Subject: # line special comments not correctly processed
Hello, perltidy reformats comment lines it should leave intact. Here is an example script print add( 3, 4 ), "\n"; print add( 4, 3 ), "\n"; sub add { my ( $term1, $term2 ) = @_; # line 1234 die "$term1 > $term2" if $term1 > $term2; return $term1 + $term2; } When reformated with perltidy (-pbp) it gives the following: print add( 3, 4 ), "\n"; print add( 4, 3 ), "\n"; sub add { my ( $term1, $term2 ) = @_; # line 1234 die "$term1 > $term2" if $term1 > $term2; return $term1 + $term2; } The #line comment is meaningful to Perl: if you run both script, you'll see that the error message is different. First script: 7 4 > 3 at foo line 1234. Reformatted script: 7 4 > 3 at foo line 9. According to perlsyn, the regular expression for matching these special comment lines is: /^\# \s* line \s+ (\d+) \s* (?:\s("?)([^"]+)\2)? \s* $/x Best regards, -- Philippe Bruhat (BooK)
Subject: Re: [rt.cpan.org #27000] # line special comments not correctly processed
Date: Tue, 8 May 2007 10:31:36 -0700
To: Philippe Bruhat via RT <bug-Perl-Tidy [...] rt.cpan.org>
From: Steve Hancock <perltidy [...] users.sourceforge.net>
Philippe, Many thanks for catching this oversight, I've got an update and will release it in then next day or two, after testing. Steve On Tue, May 08, 2007 at 11:34:45AM -0400, Philippe Bruhat via RT wrote: Show quoted text
> > Tue May 08 11:34:44 2007: Request 27000 was acted upon. > Transaction: Ticket created by BOOK > Queue: Perl-Tidy > Subject: # line special comments not correctly processed > Broken in: (no value) > Severity: Important > Owner: Nobody > Requestors: BOOK@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=27000 > > > > Hello, > > perltidy reformats comment lines it should leave intact. > Here is an example script > > > print add( 3, 4 ), "\n"; > print add( 4, 3 ), "\n"; > > sub add { > my ( $term1, $term2 ) = @_; > > # line 1234 > die "$term1 > $term2" if $term1 > $term2; > > return $term1 + $term2; > } > > When reformated with perltidy (-pbp) it gives the following: > > > print add( 3, 4 ), "\n"; > print add( 4, 3 ), "\n"; > > sub add { > my ( $term1, $term2 ) = @_; > > # line 1234 > die "$term1 > $term2" if $term1 > $term2; > > return $term1 + $term2; > } > > The #line comment is meaningful to Perl: if you run both script, you'll > see that the error message is different. > > First script: > > 7 > 4 > 3 at foo line 1234. > > Reformatted script: > > 7 > 4 > 3 at foo line 9. > > > According to perlsyn, the regular expression for matching these special > comment lines is: > > /^\# \s* > line \s+ (\d+) \s* > (?:\s("?)([^"]+)\2)? \s* > $/x > > > Best regards, > > -- Philippe Bruhat (BooK)
Thanks. This has been fixed in version 20070508.