Skip Menu |

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

Report information
The Basics
Id: 123304
Status: patched
Priority: 0/
Queue: Config-Std

People
Owner: BRICKER [...] cpan.org
Requestors: kenneth [...] olwing.se
Cc:
AdminCc:

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



Subject: Simple 'use' no longer works
Date: Mon, 16 Oct 2017 23:12:01 +0200
To: bug-Config-Std [...] rt.cpan.org
From: Kenneth Ölwing <kenneth [...] olwing.se>
An innocuous use crashes with 0.903: c:\tmp>perl -e "use Config::Std qw(read_config);" Can't use string ("read_config") as a HASH ref while "strict refs" in use at C:/etc/strawberry-perl-5.24.0.1-64bit-portable/perl/site/lib/Config/Std.pm line 15. BEGIN failed--compilation aborted at -e line 1. Leaving out the 'qw(read_config)' works. ken1
Subject: Re: [rt.cpan.org #123304] Simple 'use' no longer works
Date: Mon, 16 Oct 2017 18:34:00 -0400
To: bug-Config-Std [...] rt.cpan.org
From: Bill Ricker <bill.n1vux [...] gmail.com>
Fascinating. ​ ​Adding "use strict" is apparently breaking some dirty code in the import routine? I'll look. Thanks for the report. (First off, I need to add that as a test case. Thankfully I just set up Appveyor and Travis-CI from Github !)​
Apparently Show quoted text
> innocuous
is even more accurate than intended. It was never working, just silently did more than requested. Config::Std never honored Show quoted text
> c:\tmp>perl -e "use Config::Std qw(read_config);"
but always imports both subs whatever you ask for. (As long as you don't have anohter write_config, it's harmless?) It only accepts a use Config::Std {def_sep=>q(:), def_gap=>1 } optional customization. I don't like that. If you intend to have your config ini be read only, you should be able to import only the reader to SWYM. So I'll likely fix this to check ref or list. But need to support both at once, that'll get ugly. Obvioulsy to patch package you have, you can lift the no strict "refs"; from after the loop in 'sub import' to start and it will restore the prior silent but. (Or use 0.902, naturally) Excellent but report, pointed directly to the problem and found something bigger.
Vid Mon, 16 Oct 2017 kl. 19.44.40, skrev BRICKER: Show quoted text
> Obvioulsy to patch package you have, you can lift the > no strict "refs"; > from after the loop in 'sub import' to start and it will restore the > prior silent but. (Or use 0.902, naturally)
Thanks for your attention. I've used that construct for many years without realizing it was an error :-), really just to try to be nice and only import what I needed. But as it happens in the current situation it was just a stray and forgotten line where I wasn't using C::S at all so I could just remove it altogether. It did break my tests in a package so I had to shove up another release to cpan but that was quick. So, I'm good for the moment. Thanks, ken1
Show quoted text
> Thanks for your attention. I've used that construct for many years > without realizing it was an error :-), really just to try to be nice > and only import what I needed.
Since I think it would be nice to allow declaring read only usage, and to quietly tolerate normal usage, I'm going to fix this as I make sure we're ready for Perl 5.28 release. (the @INC . doesn't seem to affect this module, which mystifies me.) The code to accept mix of hash of values and import function names was not as bad as I expected. The hard part is now documenting what we accept :-) Thank you much for bringing it to my attention.