Skip Menu |

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

Report information
The Basics
Id: 18645
Status: resolved
Priority: 0/
Queue: Config-Std

People
Owner: BRICKER [...] cpan.org
Requestors: schwern [...] pobox.com
Cc:
AdminCc:

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



Subject: read_config and write_config can not be used without exporting
Because read_config() and write_config() do not live in the Config::Std namespace they cannot be called without exporting without breaking encapsulation of the module. require Config::Std; Config::Std::read_config(...); # not there, its in Config::Std::Hash While there's no promise this should work, its a pretty safe assumption that it will for most modules. Breaking it should be avoided without a good reason. Simply moving read_config() and write_config() into Config::Std solves this problem. As it turns out this refactoring reveals some other minor cleanup opportunities: * strict was not turned on. There were a few cases where globals were accidentaly used. * The $hash_ref inside read_config() is blessed to Config::Std::Hash but never used a an object. There is no need for the bless nor for a separate Config::Std::Hash package. * Since Config::Std::Hash is no longer a class its package lexicals no longer need to be Class::Std object attributes.
Subject: std_strict.patch

Message body is not shown because it is too large.

Subject: std_not_a_class.patch
Mon Apr 10 14:17:07 PDT 2006 schwern@pobox.com * Config::Std::Hash is not used as a class $hash_ref is never used as an object, don't bless it. Config::Std::Hash is never used as an object, no reason for its package lexicals to be object attributes. diff -rN old-Config-Std-v0.0.4/lib/Config/Std.pm new-Config-Std-v0.0.4/lib/Config/Std.pm 268d267 < use Class::Std; 273,275c272,274 < my %post_section_gap_for :ATTR; < my %array_rep_for :ATTR; < my %filename_for :ATTR; --- > my %post_section_gap_for; > my %array_rep_for; > my %filename_for; 349,350d347 < bless $hash_ref, 'Config::Std::Hash'; <
PS Apply the "not a class" patch before the "strict" patch.
PS That was me. :)
Since Damian included import rename in 0.04 I am moving this to resolved. Once I we -Boston.pm- have reviewed the rest of the queue and dealt with doc issues and actual bugs, I will apply your 'strict patch on a branch and merge to mainline, as it seems a good thing, and would appear to solve a regression reported against an unrelated fix. Bill 'n1vux' Boston.pm committer for Config;::td adoption
hmm, now i think this wasn't applied either. Will investigate. bill
adding strict to next release 0.903, in a general Kwallitee clean-up. The reason for the useless use of Class::Std in the hidden hash class is this is that Damian wrote both Config::Std and Class::Std as examples for the PBP book. While unnecessary, the double Class::Std use is pedagogically necessary, so I'm leaving that.