Shaun Guth > Interface-Param > Interface::Param

Download:
Interface-Param-0.2.tar.bz2

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.2   Source  

NAME ^

Interface::Param - Virtual class for param() method

DESCRIPTION ^

This virtual class allows you to specify that your object implements a param() method which allows storing and retrieving data quickly through an interface that is similar to CGI.pm's param() method. It enforces the calling convention of the param() method, but it does not attempt to impose any type of storage system for the key/value pairs.

SYNOPSIS ^

See Interface::Param::Hash for a useful subclass that implements the virtual methods of this interface.

METHODS ^

param ( 'field', key || (list || hash || hashref || arrayref) )

This is the core of the Interface::Param package.

'field'

A name to store the data under

'key || (list || hash || hashref || arrayref)'

If no arguments are given, param_get() will be called with no arguments.

If a single scalar argument is passed that isn't a reference, param_get() will be called with the argument and field name sent.

If multiple arguments are given, or a single argument that is a reference, the data will be unwrapped and merged into a hash using conventional means (ie, a hashref will be dereferenced, and a list will be slurped as (key1,value1,...,keyN,valueN); however, array references are treated as a special case. They are mapped with each element being both the key and the value.

VIRTUAL METHODS ^

param_get ( $field, [@keys] )

If called with no arguments, the typical response is to return a list of all keys. If called with one or more arguments, the values corresponding to those keys are returned.

param_set ( $field, \%data )

Should stores the data received from the input hash. Returns the keys set.

param_del ( $field, [@keys] )

If called with no arguments, delete all data stored for $field. If called with one or more arguments, delete the values stored for those particular keys.

AUTHOR ^

Shaun Guth <l8nite@l8nite.net>

LICENSE ^

Copyright (C) 2004 Shaun Guth

This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.

syntax highlighting: