Wolfgang Sourdeau > CGI-Listman-0.05 > CGI::Listman::dictionary

Download:
CGI-Listman-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

CGI::Listman::dictionary - list of and informations about CGI form parameters

SYNOPSIS ^

    use CGI::Listman::dictionary;

DESCRIPTION ^

A dictionary mainly serves two purposes: first, it gives the list manager a reference for what database rows are in use; second, it makes the connection between your web representation of those rows (definition) and checks whether some fields are mandatory or not.

This helps you build web pages where each mentionned field can have a readable name. For example, let's say you have a form with a field internally identified with "user_name". If the user forgets or refuses to fill in this field, CGI::Listman will return you a list containing it among other similar fields (see the check_params method of the CGI::Listman class). Furthermore, your error page could contain a more explicit field name such as "User Identification" instead of the silly "user_name" identifier.

This functionality is somewhat limited at this stage since CGI::Listman only checks the presence of mandatory fields, yet it considers strings of whitespaces as empty strings. Otherwise, it does not enforce semantics over those field. Until this is implemented, I recommend you have a look at Mark Stosberg's Data::FormValidator or Francis J. Lacoste's HTML::FormValidator modules which seem to do a pretty job.

API ^

new

Constructor with a an argument specifying the filename where to store the dictionary informations.

Parameters

The parameter "filename" is optional with this method.

filename

A string representing the path to your dictionary's storage file.

Return values

A reference to a blessed instance of CGI::Listman::dictionary.

add_term

Append an instance of CGI::Listman::dictionary::term to your dictionary's list of terms.

Parameters
term

A reference to the instance of CGI::Listman::dictionary::term you want to add to your dictionary.

Return values

This method returns nothing.

get_term

This method returns the CGI::Listman::dictionary::term corresponding to the key given as parameter.

Parameters
key

The key of the term you wish to be returned.

Return values

A reference to an instance of CGI::Listman::dictionary::term or undef if the key was not found.

terms

Returns the list of terms.

Parameters

This method takes no parameter.

Return values

A reference to the ARRAY containing the list of terms.

term_pos_in_list

Parameters
term

An instance of CGI::Listman::dictionary::term you wish to know the position of in the list.

Return values

This method returns an integer corresponding to that term in the list's order or -1 if the term was not found.

reposition_term

This functions serves the purpose of reposition a term relatively to its siblings. Giving a value that is to high or low will silently cancel the operation. This function is generally called by the increase_... and decrease_... functions.

Parameters
term

An instance of CGI::Listman::dictionary::term you wish to move in the dictionary's internal list.

delta

An positive or negative integer giving the number of steps the term has to be moved from.

Return values

This method returns nothing.

increase_term_pos

This method is similar to reposition_term above except that its increment is optional. If not present, the increment is assumed to be 1.

Parameters
increment

An optional positive or negative integer giving the number of steps the term has to be moved from.

Return values

This method returns nothing.

decrease_term_pos

This method is similar to reposition_term above except that its decrement is optional and considered negative. If not present, the decrement is assumed to be 1.

Parameters
decrement

An optional positive or negative integer giving the number of steps the term has to be moved from.

Return values

This method returns nothing.

increase_term_pos_by_key

Parameters
key

The key corresponding to the CGI::Listman::dictionary::term you would like to increase in the list.

increment

An integer representing the amount of slots to increment the term by. If not specified, this amount will be 1.

Return values

This method returns nothing.

decrease_term_pos_by_key

Parameters
key

The key corresponding to the CGI::Listman::dictionary::term you would like to move in the list.

decrement

An integer representing the amount of slots to decrement the term by. If not specified, this amount will be 1.

Return values

This method returns nothing.

save

Parameters

This method takes no parameter.

Return values

This method returns nothing.

AUTHOR ^

Wolfgang Sourdeau, <Wolfgang@Contre.COM>

COPYRIGHT ^

Copyright (C) 2002 iScream multimédia <info@iScream.ca>

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

SEE ALSO ^

CGI::Listman::dictionary::term(3)

syntax highlighting: