Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: nobull67 [...] gmail.com
Cc:
AdminCc:

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



Subject: RenameSection method wanted
I find myself really wanting a RenameSection method... =head2 RenameSection ( $sect_name, $new_sect_name ) Renames a section. Does nothing if a section already exists with the new name. =cut sub RenameSection { my $self = shift; my $sect = shift; my $new_sect = shift; return if not defined $sect; return if not defined $new_sect; if ($self->{nocase}) { $sect = lc($sect); $sect = lc($sect); } return if $sect eq $new_sect; return if $self->SectionExists($new_sect); # This is done, the fast way, change if delval changes!! for ( qw( v sCMT pCMT EOT parms ) ) { $self->{$_}{$new_sect} = delete $self->{$_}{$sect}; } @{$self->{sects}} = map { $sect eq $_ ? $new_sect : $_ } @{$self->{sects}}; $self->RemoveGroupMember($sect); $self->SetGroupMember($new_sect); return 1; } # end RenameSection
Hi! Thanks for your contribution. See below for my comments. On Wed Apr 15 06:20:21 2009, NOBULL wrote: Show quoted text
> I find myself really wanting a RenameSection method... > > > =head2 RenameSection ( $sect_name, $new_sect_name ) > > Renames a section. Does nothing if a section already exists with the new > name. > > =cut > > sub RenameSection { > my $self = shift; > my $sect = shift; > my $new_sect = shift; > > return if not defined $sect; > return if not defined $new_sect; > > if ($self->{nocase}) { > $sect = lc($sect); > $sect = lc($sect);
One of these should be $new_sect Show quoted text
> } > > return if $sect eq $new_sect; > return if $self->SectionExists($new_sect); > > # This is done, the fast way, change if delval changes!! > for ( qw( v sCMT pCMT EOT parms ) ) { > $self->{$_}{$new_sect} = delete $self->{$_}{$sect}; > } > > @{$self->{sects}} = map { $sect eq $_ ? $new_sect : $_ } > @{$self->{sects}}; > > $self->RemoveGroupMember($sect); > $self->SetGroupMember($new_sect); > > return 1; > } # end RenameSection >
Please include a test file with some test assertions for this feature, and submit it as a patch against: http://config-inifiles.svn.sourceforge.net/svnroot/config-inifiles/trunk/ Regards, Shlomi Fish
Subject: Re: [rt.cpan.org #45058] RenameSection method wanted
Date: Wed, 15 Apr 2009 11:37:11 +0100
To: bug-Config-IniFiles [...] rt.cpan.org
From: Brian McCauley <nobull67 [...] gmail.com>
2009/4/15 Shlomi Fish via RT <bug-Config-IniFiles@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 >
> > > > if ($self->{nocase}) { > > $sect = lc($sect); > > $sect = lc($sect);
> > One of these should be $new_sect >
Oops, never use the nocase option myself so I missed that. Show quoted text
> > Please include a test file with some test assertions for this feature, > and submit it as a patch against: > > http://config-inifiles.svn.sourceforge.net/svnroot/config-inifiles/trunk
Will do, thanks.
On Wed Apr 15 06:38:26 2009, NOBULL wrote: Show quoted text
> 2009/4/15 Shlomi Fish via RT <bug-Config-IniFiles@rt.cpan.org> >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 >
> > > > > > if ($self->{nocase}) { > > > $sect = lc($sect); > > > $sect = lc($sect);
> > > > One of these should be $new_sect > >
> > Oops, never use the nocase option myself so I missed that. >
> > > > Please include a test file with some test assertions for this feature, > > and submit it as a patch against: > > > > http://config-inifiles.svn.sourceforge.net/svnroot/config-inifiles/trunk
> > > Will do, thanks.
Any news regarding this patch?
Subject: Re: [rt.cpan.org #45058] RenameSection method wanted
Date: Sun, 3 May 2009 10:40:58 +0100
To: bug-Config-IniFiles [...] rt.cpan.org
From: Brian McCauley <nobull67 [...] gmail.com>
2009/5/2 Shlomi Fish via RT <bug-Config-IniFiles@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 > > > On Wed Apr 15 06:38:26 2009, NOBULL wrote:
> > 2009/4/15 Shlomi Fish via RT <bug-Config-IniFiles@rt.cpan.org<https://mail.google.com/mail?view=cm&tf=0&to=bug-Config-IniFiles@rt.cpan.org> > > > >
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 >
> > > > > > > > if ($self->{nocase}) { > > > > $sect = lc($sect); > > > > $sect = lc($sect);
> > > > > > One of these should be $new_sect > > >
> > > > Oops, never use the nocase option myself so I missed that. > >
> > > > > > Please include a test file with some test assertions for this feature, > > > and submit it as a patch against: > > > > > >
> http://config-inifiles.svn.sourceforge.net/svnroot/config-inifiles/trunk
> > > > > > Will do, thanks.
> > Any news regarding this patch? > > Thanks for the reminder. Been a bit busy lately and it had slipped my mind.
I will do some Perl-ish things tomorrow (like start worrying about the number of talks I just got accepted in Lisbon!). Will try to get you a patch in the bext few days.
On Sun May 03 05:41:19 2009, NOBULL wrote: Show quoted text
> 2009/5/2 Shlomi Fish via RT <bug-Config-IniFiles@rt.cpan.org> >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 > > > > > On Wed Apr 15 06:38:26 2009, NOBULL wrote:
> > > 2009/4/15 Shlomi Fish via RT <bug-Config-
> IniFiles@rt.cpan.org<https://mail.google.com/mail?view=cm&tf=0&to=bug- > Config-IniFiles@rt.cpan.org>
> > > > > >
> > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=45058 >
> > > > > > > > > > if ($self->{nocase}) { > > > > > $sect = lc($sect); > > > > > $sect = lc($sect);
> > > > > > > > One of these should be $new_sect > > > >
> > > > > > Oops, never use the nocase option myself so I missed that. > > >
> > > > > > > > Please include a test file with some test assertions for this
> feature,
> > > > and submit it as a patch against: > > > > > > > >
> > http://config-inifiles.svn.sourceforge.net/svnroot/config-
> inifiles/trunk
> > > > > > > > > Will do, thanks.
> > > > Any news regarding this patch? > > > > Thanks for the reminder. Been a bit busy lately and it had slipped
> my mind. > I will do some Perl-ish things tomorrow (like start worrying about the > number of talks I just got accepted in Lisbon!). > > Will try to get you a patch in the bext few days.
Hi! Any news regarding this patch? Regards, Shlomi Fish
No patch supplied so closing as OLD. Please reply to this issue with a comprehensive patch attached if you want to re-open it.