NAME

Web::VWF::Display::table - Read a small flat file for a page or its template

VERSION

Version 0.003.0

DESCRIPTION

This is not a page and so it is not in the display setting: it does not inherit from Web::VWF::Display. It is a helper for a page or template that wants a small !-separated file with a header line, read from databases/NAME in the site's root_dir. Blank lines and lines starting with # are ignored. The site's own settings are found with Config::Auto in $DOCUMENT_ROOT/../lib/conf, or $HOME/lib/conf.

METHODS

new

Takes info (a CGI::Info, made if not given) and table, the file's name, which is the class name, with / for ::, if not given. Dies when the configuration cannot be read.

get_file_path

The path of the file, which must be readable and inside databases/. Dies otherwise.

columns

The names of the columns, as an array reference.

fetch

With key, the row with that first column as a hash reference; without, all the rows as an array reference of hash references.

fetch_as_hash

All the rows as a hash reference keyed on the first column.

load_data

Reads the file once. The other methods call it.

API SPECIFICATION

INPUT

{ info => { type => 'object', optional => 1 }, table => { type => 'string', optional => 1 } }

OUTPUT

{ type => 'object', isa => 'Web::VWF::Display::table' }

AUTHOR

Nigel Horne, <njh at nigelhorne.com>

LICENCE AND COPYRIGHT

Copyright 2010-2026 Nigel Horne.

Usage is subject to the GPL2 licence terms. If you use it, please let me know.