The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Config::Objective::Table - table data type class for Config::Objective

SYNOPSIS

  use Config::Objective;
  use Config::Objective::Table;

  my $conf = Config::Objective->new('filename', {
                        'tableobj'      => Config::Objective::Table->new()
                });

DESCRIPTION

The Config::Objective::Table module provides a class that represents a table value in an object so that it can be used with Config::Objective. Its methods can be used to manipulate the encapsulated table value from the config file.

The table data is represented as a list of lists. Both rows and columns are indexed starting at 0. It is derived from the Config::Objective::List class, but it supports the following additional methods:

add_before()

Inserts a new row into the table before a specified row. The argument must be a reference to a list containing three elements: a number indicating what column to search on, a string which is used as a regular expression match to find a matching row in the table, and a reference to the new list to be inserted before the matching row.

find()

Finds a row with a specified word in a specified column. The column number is the first argument, and the word to match on is the second. It returns a reference to the matching row, or undef if no matches were found.

This function is not very useful for calling from a config file, but it's sometimes useful to call it from perl once the config file has been read.

replace()

Finds a row in the same manner as find(), and then replaces that row's value in a specified column with a new value. The arguments are the column number to search on, the word to search for, the column number to replace, and the text to replace it with.

modify()

Similar to replace(), but appends to the existing value instead of replacing it. A space character is appended before the new value.

AUTHOR

Mark D. Roth <roth@uiuc.edu>

SEE ALSO

perl

Config::Objective

Config::Objective::List