Skip Menu |

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

Report information
The Basics
Id: 81874
Status: new
Priority: 0/
Queue: Config-Tiny

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

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



Subject: enhancement request
Date: Mon, 10 Dec 2012 20:06:28 -0600
To: bug-Config-Tiny [...] rt.cpan.org
From: samwyse <samwyse [...] gmail.com>
it would be nice if 'read' and 'read_string' were defined using 'my $self = ref $_[0] ? shift : bless {}, shift;' Yes, I realize that this (in theory) could break existing code, but the advantages are fairly big, IMHO. This simple change wouldn't increase the size of the module, but would allow straightforward code like this: my $config = Config::Tiny->new(); # set hard-coded defaults $config->read_string(<<DEFAULTS); [section] this = a value that = another value DEFAULTS # merge site defaults, over-riding the above $config->read("/etc/config.ini"); # set user-specified values $config->read("$ENV{HOME}/.config.ini"); Pre-existing code like this would continue to work: my $config = Config::Tiny->read('config.ini');