Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: simon.reinhardt [...] stud.uni-regensburg.de
Cc:
AdminCc:

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



Subject: custom Getopt::Long configuration breaks parsing of perltidyrc
Date: Sun, 30 Oct 2016 09:49:58 +0100
To: bug-Perl-Tidy [...] rt.cpan.org
From: Simon Reinhardt <simon.reinhardt [...] stud.uni-regensburg.de>
Download (untitled) / with headers
text/plain 438b
Hi, Using Getopt::Long with config 'bundling' seems to be incompatible with Perl::Tidy: use Getopt::Long qw/:config bundling/; use Perl::Tidy; perltidy( perltidyrc => 'perltidyrc', ); If 'perltiyrc' contains a line like '-npro', this script dies with this message: Unknown option: n Unknown option: p Unknown option: r Unknown option: o Error in this config file: perltidyrc Use -npro to ignore this file, -h for help'
Download signature.asc
application/pgp-signature 819b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 1.2k
On 2016-10-30 03:50:17, simon.reinhardt@stud.uni-regensburg.de wrote: Show quoted text
> Hi, > > Using Getopt::Long with config 'bundling' seems to be incompatible with > Perl::Tidy: > > > use Getopt::Long qw/:config bundling/; > > use Perl::Tidy; > > perltidy( > perltidyrc => 'perltidyrc', > ); > > > If 'perltiyrc' contains a line like '-npro', this script dies with this > message: > > > Unknown option: n > Unknown option: p > Unknown option: r > Unknown option: o > Error in this config file: perltidyrc > Use -npro to ignore this file, -h for help'
I'm seeing a similar issue when calling the perltidy() sub from some code and passing "argv => q{--profile=...}". The --profile gets turned into -profile, causing an error later. From reading the code, this happens at line 2220 in the 20160320 release: $i =~ s/^--/-/; This is applied to each element of @ARGV. I have no idea what this code is intended to do, but it seems like modifying @ARGV in place and then using it later in the same sub is just going to cause breakage. In my case, this only happens when running Test::Code::TidyAll under Test::Class::Moose::CLI. I'm guessing that having the CLI code call Getopt::Long earlier somehow causes something to go wrong. It's quite a web to disentangle this.
Download (untitled) / with headers
text/plain 245b
Further investigation showed that calling Getopt::Long::ConfigDefaults() before invoking perltidy() fixed my problem. I think perltidy needs to wrap every call to GetOptions with a reset of the defaults. It does this once, but not in every call.
Subject: Re: [rt.cpan.org #118558] custom Getopt::Long configuration breaks parsing of perltidyrc
Date: Tue, 16 May 2017 07:38:45 -0700
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Download (untitled) / with headers
text/plain 559b
Dave, Thanks. The problem was that the user's configuration was being reset too soon. I expect a new version to be out by next week. Steve On 5/12/17, Dave Rolsky via RT <bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Queue: Perl-Tidy > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=118558 > > > Further investigation showed that calling Getopt::Long::ConfigDefaults() > before invoking perltidy() fixed my problem. I think perltidy needs to wrap > every call to GetOptions with a reset of the defaults. It does this once, > but not in every call. >
This is fixed in version 20170521.


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.