Skip Menu |
 

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

Report information
The Basics
Id: 125025
Status: resolved
Priority: 0/
Queue: Config-IniFiles

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

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



From: roam [...] ringlet.net
Subject: [PATCH] Reuse section hashes in Config::IniFiles::FETCH
Download (untitled) / with headers
text/plain 1.4k
Hi, First of all, thanks a lot for taking care of Config::IniFiles! It's an extremely useful module for adding very simple support for configuration files to simple tools. What do you think about the attached patch that we just added to the Debian package? It fixes a problem reported on the Debian bug tracker: https://bugs.debian.org/849298 Now, I am aware that just this patch does not go all the way in making a tied Config::IniFiles hash emulate the each() behavior of untied hashes (e.g. the session is not reset after a keys() or values() call), but according to the documenation of each(), this is not necessary. Even like this, the change makes each() actually useful on these hashes. Description: Reuse section hashes in Config::IniFiles::FETCH As reported by Johannes Schauer, code like foreach my $s (keys %ini) { while (my ($k,$v) = each %{$ini{$s}}) { print("$s $k $v\n"); } } goes to an infinite loop. This is because every time $ini{$s} is evaluated, Config::IniFiles::FETCH() creates a new Config::IniFiles::_section tied hash that has its own each() iterator. Store and reuse the section hashes instead. Bug-Debian: https://bugs.debian.org/849298 Author: Niko Tyni <ntyni@debian.org> Last-Update: 2018-04-05 The patch is tracked in our Git repository at https://salsa.debian.org/perl-team/modules/packages/libconfig-inifiles-perl/raw/master/debian/patches/fetch.patch Thanks for considering, and keep up the great work! Peter Pentchev, Debian Perl Group
Here's the patch.
Download fetch.patch
text/x-diff 1.5k

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #125025] [PATCH] Reuse section hashes in Config::IniFiles::FETCH
Date: Sat, 7 Apr 2018 10:17:10 +0300
To: bug-Config-IniFiles [...] rt.cpan.org
From: Shlomi Fish <shlomif [...] shlomifish.org>
Download (untitled) / with headers
text/plain 821b
On Fri, 6 Apr 2018 16:39:58 -0400 "Peter Pentchev via RT" <bug-Config-IniFiles@rt.cpan.org> wrote: Show quoted text
> Queue: Config-IniFiles > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125025 > > > Here's the patch.
Thanks! I will likely apply it. Note, however, that using the tie interface (or tie interfaces in general) is really discouraged - see https://en.wikipedia.org/wiki/Perl_Best_Practices . Regards, Shlomi -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ https://youtu.be/GoEn1YfYTBM - Tiffany Alvord - “Fall Together” <rindolf> You are all Nazis! ;-) <tadzik> People who invoke Godwin’s law are worse than Hitler. — Freenode’s #perl Please reply to list if it's a mailing list post - http://shlom.in/reply .
Download (untitled) / with headers
text/plain 551b
applied and part of the new release. On Sat Apr 07 03:38:59 2018, shlomif@shlomifish.org wrote: Show quoted text
> On Fri, 6 Apr 2018 16:39:58 -0400 > "Peter Pentchev via RT" <bug-Config-IniFiles@rt.cpan.org> wrote: >
> > Queue: Config-IniFiles > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125025 > > > > > Here's the patch.
> > Thanks! I will likely apply it. Note, however, that using the tie > interface (or > tie interfaces in general) is really discouraged - see > https://en.wikipedia.org/wiki/Perl_Best_Practices . > > Regards, > > Shlomi


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.