Skip Menu |

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

Report information
The Basics
Id: 90261
Status: stalled
Priority: 0/
Queue: Config-IniFiles

People
Owner: Nobody in particular
Requestors: DAshirov [...] mindspark.com
Cc:
AdminCc:

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



Subject: I::F - fileno support? C:IF - I::F support ?
Date: Mon, 11 Nov 2013 15:02:53 +0000
To: "bug-Config-IniFiles [...] rt.cpan.org" <bug-Config-IniFiles [...] rt.cpan.org>, "bug-Inline-Files [...] rt.cpan.org" <bug-Inline-Files [...] rt.cpan.org>
From: David Ashirov <DAshirov [...] mindspark.com>
Hello Alberto and Shlomi, Below is not necessarily a bug, more of a missing feature. I'm not sure which module (Config::IniFiles or Inline::Files) is best to add support for one another. I do however want to start a discussion. Whenever I tried to make the two ingenious modules to work together, I failed. 1. Config::IniFiles complains that Inline::Files has not implemented &fileno and bails out when passed a GLOB or a ref to a GLOB returned by Inline::Files. Use Config::IniFiles; Use Inline::Files; open CONFIG,shift(@main::CONFIG); new Config::IniFiles(-file=>*CONFIG,-reloadwarn=>1) __INLINE__ Something 1 __INLINE__ Something 2 __END__ [my config] A=b B=c Bizarre copy of HASH in list assignment at /apps/perlbrew/perls/perl-5.18.1/lib/5.18.1/Carp.pm line 165. 2. Inline::Files also messes with *main::DATA, so Config::IniFiles cant load the inline configuration using standard methodology - it complains of "Bizarre copy of HASH in list assignment" Use Config::IniFiles; Use Inline::Files; new Config::IniFiles(-file=>*DATA,-reloadwarn=>1) __INLINE__ Something 1 __INLINE__ Something 2 __END__ [my config] A=b B=c Inline::Files::Virtual::FILENO not yet implemented at /apps/perlbrew/libs/perl-5.18.1@feeds/lib/perl5/Config/IniFiles.pm line 2766. I would love to have the two modules work together as the possibilities are just too good to ignore ( Inline::Files supports read/write access too !) Thanks for your time, David Ashirov.
Hi David, I'm not sure if we still need to check fileno() on Config::IniFiles, so I may remove this and allow it to use any filehandle - whether it implements fileno() or not. Otherwise, did you try to load and save the Inline::Files files while going through strings in both directions? Regards, -- Shlomi Fish
Subject: RE: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F support ?
Date: Mon, 11 Nov 2013 15:54:27 +0000
To: "bug-Config-IniFiles [...] rt.cpan.org" <bug-Config-IniFiles [...] rt.cpan.org>
From: David Ashirov <DAshirov [...] mindspark.com>
Do you mean scalar? use Config::IniFiles; use Inline::Files; my ($config_text,$config_obj); open (CFG, shift(@main::CONFIG_PRD)); { $/=undef; $config_text =<CFG>; } $config_obj=Config::IniFiles->new( -file => \$config_text ); $DB::single=1; __CONFIG_PRD__ [main] a=b b=c __CONFIG_DEV__ [main] a=b b=c Failed to open SCALAR(0x245c088): No such file or directory Show quoted text
-----Original Message----- From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] Sent: Monday, November 11, 2013 10:42 AM To: David Ashirov Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F support ? <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > Hi David, I'm not sure if we still need to check fileno() on Config::IniFiles, so I may remove this and allow it to use any filehandle - whether it implements fileno() or not. Otherwise, did you try to load and save the Inline::Files files while going through strings in both directions? Regards, -- Shlomi Fish
Hi David, On Mon Nov 11 10:54:41 2013, DAshirov@mindspark.com wrote: Show quoted text
> Do you mean scalar? >
No, I mean: 1. Slurp the Inline::Files file into a string. 2. Pass the string to Config::IniFiles. 3. Manipulate the Config::IniFiles object. 4. Have it write a new string. 5. Write this string to the Inline::Files file. Regards, -- Shlomi Fish Show quoted text
> use Config::IniFiles; > use Inline::Files; > my ($config_text,$config_obj); > open (CFG, shift(@main::CONFIG_PRD)); > { > $/=undef; > $config_text =<CFG>; > } > $config_obj=Config::IniFiles->new( -file => \$config_text ); > > $DB::single=1; > > __CONFIG_PRD__ > [main] > a=b > b=c > > __CONFIG_DEV__ > [main] > a=b > b=c > > > Failed to open SCALAR(0x245c088): No such file or directory > > > -----Original Message----- > From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] > Sent: Monday, November 11, 2013 10:42 AM > To: David Ashirov > Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F > support ? > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > > > Hi David, > > I'm not sure if we still need to check fileno() on Config::IniFiles, > so I may remove this and allow it to use any filehandle - whether it > implements fileno() or not. Otherwise, did you try to load and save > the Inline::Files files while going through strings in both > directions? > > Regards, > > -- Shlomi Fish
Subject: RE: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F support ?
Date: Mon, 11 Nov 2013 22:55:29 +0000
To: "bug-Config-IniFiles [...] rt.cpan.org" <bug-Config-IniFiles [...] rt.cpan.org>
From: David Ashirov <DAshirov [...] mindspark.com>
1. What the code is doing: 1.Slurp ->2.Pass to C:IF, at which point C:IF breaks with no such file or directory error. 2. Documentation states that newer IO::Scalar is required. After installing IO::Scalar it worked on reading the configuration in. But, A. An attempt to rewrite it back from where it came from (scalar) failed: Operation "==": no method found, left argument in overloaded package IO::Scalar, right argument has no overloaded magic at /apps/perlbrew/libs/perl-5.18.1@feeds/lib/perl5/Config/IniFiles.pm line 1780. B. If I try to write directly to virtual filehandle I get the following error: -e on unopened filehandle CFG at /apps/perlbrew/libs/perl-5.18.1@feeds/lib/perl5/Config/IniFiles.pm line 1722. Code tested below: use Config::IniFiles; use Inline::Files; $DB::single=1; my ($config_text,$config_obj); open (CFG, "<", $CONFIG_PRD) or die $!; { $/=undef; $config_text =<CFG>; } open (CFG,">",$CONFIG_DEV) or die $!; $config_obj=Config::IniFiles->new( -file => \$config_text ); $config_obj->setval(qw/main a/,"new value"); # Below will fail (A) eval { $config_obj->SetFileName(*CFG); $config_obj->RewriteConfig(); }; if (my $e=$@ ){ warn "FAIL: $e"; } # Below will fail (B) eval { $config_obj->WriteConfig(\$config_text); }; if (my $e = $@){ warn "FAIL: $e"; } __CONFIG_PRD__ [main] a=b b=c __CONFIG_DEV__ [main] a=b b=c __END__ select blah from blah Show quoted text
-----Original Message----- From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] Sent: Monday, November 11, 2013 11:05 AM To: David Ashirov Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F support ? <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > Hi David, On Mon Nov 11 10:54:41 2013, DAshirov@mindspark.com wrote:
> Do you mean scalar? >
No, I mean: 1. Slurp the Inline::Files file into a string. 2. Pass the string to Config::IniFiles. 3. Manipulate the Config::IniFiles object. 4. Have it write a new string. 5. Write this string to the Inline::Files file. Regards, -- Shlomi Fish
> use Config::IniFiles; > use Inline::Files; > my ($config_text,$config_obj); > open (CFG, shift(@main::CONFIG_PRD)); > { > $/=undef; > $config_text =<CFG>; > } > $config_obj=Config::IniFiles->new( -file => \$config_text ); > > $DB::single=1; > > __CONFIG_PRD__ > [main] > a=b > b=c > > __CONFIG_DEV__ > [main] > a=b > b=c > > > Failed to open SCALAR(0x245c088): No such file or directory > > > -----Original Message----- > From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] > Sent: Monday, November 11, 2013 10:42 AM > To: David Ashirov > Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F > support ? > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > > > Hi David, > > I'm not sure if we still need to check fileno() on Config::IniFiles, > so I may remove this and allow it to use any filehandle - whether it > implements fileno() or not. Otherwise, did you try to load and save > the Inline::Files files while going through strings in both > directions? > > Regards, > > -- Shlomi Fish
Is there any progress on this bug? On Mon Nov 11 17:55:45 2013, DAshirov@mindspark.com wrote: Show quoted text
> 1. What the code is doing: 1.Slurp ->2.Pass to C:IF, at which point > C:IF breaks with no such file or directory error. > 2. Documentation states that newer IO::Scalar is required. After > installing IO::Scalar it worked on reading the configuration in. > > But, > > A. An attempt to rewrite it back from where it came from (scalar) > failed: > Operation "==": no method found, > left argument in overloaded package IO::Scalar, > right argument has no overloaded magic at > /apps/perlbrew/libs/perl-5.18.1@feeds/lib/perl5/Config/IniFiles.pm > line 1780. > > B. If I try to write directly to virtual filehandle I get the > following error: > -e on unopened filehandle CFG at /apps/perlbrew/libs/perl- > 5.18.1@feeds/lib/perl5/Config/IniFiles.pm line 1722. > > > > Code tested below: > > use Config::IniFiles; > use Inline::Files; > $DB::single=1; > my ($config_text,$config_obj); > open (CFG, "<", $CONFIG_PRD) or die $!; > { > $/=undef; > $config_text =<CFG>; > } > open (CFG,">",$CONFIG_DEV) or die $!; > $config_obj=Config::IniFiles->new( -file => \$config_text ); > $config_obj->setval(qw/main a/,"new value"); > > # Below will fail (A) > eval { > $config_obj->SetFileName(*CFG); > $config_obj->RewriteConfig(); > }; if (my $e=$@ ){ > warn "FAIL: $e"; > } > > # Below will fail (B) > eval { > $config_obj->WriteConfig(\$config_text); > }; if (my $e = $@){ > warn "FAIL: $e"; > } > > > > > > __CONFIG_PRD__ > [main] > a=b > b=c > __CONFIG_DEV__ > [main] > a=b > b=c > __END__ > select blah from blah > > > > -----Original Message----- > From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] > Sent: Monday, November 11, 2013 11:05 AM > To: David Ashirov > Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F > support ? > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > > > Hi David, > > On Mon Nov 11 10:54:41 2013, DAshirov@mindspark.com wrote:
> > Do you mean scalar? > >
> > No, I mean: > > 1. Slurp the Inline::Files file into a string. > > 2. Pass the string to Config::IniFiles. > > 3. Manipulate the Config::IniFiles object. > > 4. Have it write a new string. > > 5. Write this string to the Inline::Files file. > > Regards, > > -- Shlomi Fish >
> > use Config::IniFiles; > > use Inline::Files; > > my ($config_text,$config_obj); > > open (CFG, shift(@main::CONFIG_PRD)); > > { > > $/=undef; > > $config_text =<CFG>; > > } > > $config_obj=Config::IniFiles->new( -file => \$config_text ); > > > > $DB::single=1; > > > > __CONFIG_PRD__ > > [main] > > a=b > > b=c > > > > __CONFIG_DEV__ > > [main] > > a=b > > b=c > > > > > > Failed to open SCALAR(0x245c088): No such file or directory > > > > > > -----Original Message----- > > From: Shlomi Fish via RT [mailto:bug-Config-IniFiles@rt.cpan.org] > > Sent: Monday, November 11, 2013 10:42 AM > > To: David Ashirov > > Subject: [rt.cpan.org #90261] I::F - fileno support? C:IF - I::F > > support ? > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90261 > > > > > Hi David, > > > > I'm not sure if we still need to check fileno() on Config::IniFiles, > > so I may remove this and allow it to use any filehandle - whether it > > implements fileno() or not. Otherwise, did you try to load and save > > the Inline::Files files while going through strings in both > > directions? > > > > Regards, > > > > -- Shlomi Fish
> > >