Config of a Store

Toby Inkster mail at tobyinkster.co.uk
Mon Jun 28 09:15:51 CEST 2010


On Mon, 28 Jun 2010 08:12:32 +0200
Kjetil Kjernsmo <kjetil at kjernsmo.net> wrote:

> 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.

As I understand it, you could just do:

sub _new_from_object
{
	my ($class, $object) = @_;
	if (ref $object eq 'HASH' && lc $object->{'store'} eq 'mystore')
	{
		my $self = bless {}, $class;
		# do stuff with details in $object
		return $self;
	}
	return undef;
}

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>



More information about the Dev mailing list