Skip Menu |

This queue is for tickets about the Config-Tiny CPAN distribution.

Report information
The Basics
Id: 17433
Status: resolved
Priority: 0/
Queue: Config-Tiny

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

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



Subject: [patch] Remove inline comments from values
Hello, Config::Tiny is incorrectly including comments on the same line as a parameter definition in the parameter value. For example, I was trying to read a php.ini that contains lines like: max_execution_time = 30 ; Maximum execution time of each script Config::Tiny puts the value "30 ; Maximum execution time of each script" for max_execution_time, instead of just "30". The attached patch fixes this. -- Close the world, txEn eht nepO.
Subject: Config-Tiny-2.04-inline-comments.patch
--- lib/Config/Tiny.pm.orig 2006-02-02 11:24:26.449656447 +0100 +++ lib/Config/Tiny.pm 2006-02-02 11:28:36.015354001 +0100 @@ -48,6 +48,9 @@ # Skip comments and empty lines next if /^\s*(?:\#|\;|$)/; + # Remove inline comments + s/\s*[#;].*$//; + # Handle section headers if ( /^\s*\[\s*(.+?)\s*\]\s*$/ ) { # Create the sub-hash if it doesn't exist.
On Thu Feb 02 05:32:51 2006, SAPER wrote: Show quoted text
> Hello, > > Config::Tiny is incorrectly including comments on the same line > as a parameter definition in the parameter value. For example, > I was trying to read a php.ini that contains lines like: > > max_execution_time = 30 ; Maximum execution time of each script > > Config::Tiny puts the value "30 ; Maximum execution time of each > script" for max_execution_time, instead of just "30". > > The attached patch fixes this.
This adds functionality, and I'm tempted not to apply it. Config::Tiny has never advertised that it allows inline comments. Can you demonstrate that this is a compulsory part of the .ini file spec (such as it is?) Do you have URIs?
Subject: Re: [rt.cpan.org #17433] [patch] Remove inline comments from values
Date: Fri, 24 Feb 2006 23:49:31 +0100
To: bug-Config-Tiny [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Show quoted text
> This adds functionality, and I'm tempted not to apply it. > > Config::Tiny has never advertised that it allows inline comments.
I perfectly understand that point, but.. (read below) Show quoted text
> Can you demonstrate that this is a compulsory part of the .ini file spec > (such as it is?) Do you have URIs?
I can! Just found the relevant bit on Microsoft Technet site: http://www.microsoft.com/technet/archive/wfw/2_ch6.mspx Quoting the first lines of the "Format of the .INI Files" section: The Windows for Workgroups setup information (.INI) files are text files that contain one or more sections. The format for each section is: [section] keyname= value ; comment So it looks like inline comments are perfectly valid. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
I'm applying a literal version of the spec here. That is, ONLY ; will indicate an inline comment, and it must have a space on EITHER side of it initially. This should prevent 90% of the problem that might come from things like myuri=htt://something.com/foo#page