Config of a Store

Kjetil Kjernsmo kjetil at kjernsmo.net
Mon Jun 28 08:12:32 CEST 2010


On Sunday 27. June 2010 23:23:02 Toby Inkster wrote:
> On Sun, 27 Jun 2010 14:17:30 +0200
> 
> Kjetil Kjernsmo <kjetil at kjernsmo.net> wrote:
> > I feel that it would be better to pass a hashref with the config,
> > than coming up with a universal string to work in all circumstances.
> 
> There's a certain appeal to using a plain string. A string can easily
> be stored in a configuration file, or passed as a command line
> parameter.

Yeah, I can see that, and I'm not removing the string. Also, I was starting 
to hit the limit of what could be reasonably be encoded in a string without 
re-inventing YAML. And then, there really isn't a big advantage to a simple 
string in config files, as it is very simple to use YAML, or any other 
syntax supported by Config::Any. I can see the point about command-line 
usage, but I feel that you cannot expect to use the full feature set by a 
simple string.

> 
> If you want to instantiate a store using a hashref, there's
> new_with_object since 0.123. While it's probably designed to take a
> blessed object, there doesn't seem to be anything preventing it from
> taking a plain hashref.

Yeah, I looked at it, but its intentions were quite different from mine, it 
appears, even though I shall admit I didn't grok it. My intention was to 
have a transparent hash, and it didn't seem like many backends supported it 
yet anyway (only DBI and Redland does). Also, new_with_object just loops 
the available backends to see if something fits, which means you need to 
know what triggers the different backends, so I wanted something that said 
clearly what you were setting up.

So, I ended up writing the code last night, and pushed it to github for 
Greg to have a look :-)

Cheers,

Kjetil
-- 
Kjetil Kjernsmo
kjetil at kjernsmo.net
http://www.kjetil.kjernsmo.net/


More information about the Dev mailing list