NAME

Data::Hive::Store::Param - CGI::param-like store for Data::Hive

VERSION

version 1.015

DESCRIPTION

This hive store will soon be overhauled.

Basically, it expects to access a hive in an object with CGI's param method, or the numerous other things with that interface.

PERL VERSION

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

METHODS

new

# use default method name 'param'
my $store = Data::Hive::Store::Param->new($obj);

# use different method name 'info'
my $store = Data::Hive::Store::Param->new($obj, { method => 'info' });

# escape certain characters in keys
my $store = Data::Hive::Store::Param->new($obj, { escape => './!' });

Return a new Param store.

Several interesting arguments can be passed in a hashref after the first (mandatory) object argument.

method

Use a different method name on the object (default is 'param').

This method should have the "usual" behavior for a param method:

  • calling $obj->param with no arguments returns all param names

  • calling $obj->param($name) returns the value for that name

  • calling $obj->param($name, $value) sets the value for the name

The Param store does not check the types of values, but for interoperation with other stores, sticking to simple scalars is a good idea.

path_packer

This is an object providing the Data::Hive::PathPacker interface. It will convert a string to a path (arrayref) or the reverse. It defaults to a Data::Hive::PathPacker::Strict.

exists

This is a coderef used to check whether a given parameter name exists. It will be called as a method on the Data::Hive::Store::Param object with the path name as its argument.

The default behavior gets a list of all parameters and checks whether the given name appears in it.

delete

This is a coderef used to delete the value for a path from the hive. It will be called as a method on the Data::Hive::Store::Param object with the path name as its argument.

The default behavior is to call the delete method on the object providing the param method.

AUTHORS

  • Hans Dieter Pearcey <hdp@cpan.org>

  • Ricardo Signes <cpan@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2006 by Hans Dieter Pearcey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.