The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

version 1.013

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.

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 <rjbs@cpan.org>

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.