[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .

Methods / Operation Vector

Mentioned above, the fundamental methods of IO::Adapter are as follows:

open()
close()
add(KEY, ARGV) (ARGV = class dependent)
delete(KEY)
find(KEY or REGEXP)
get_next_key()

Other than these methods, new() as a constructor and destructor() are needed.

The constructor is new() methond. For example, use like this;

$obj = new IO::Adapter MAP;
The argument is a map which calls map dependent constructor.

open()

For a file, call open(2), for RDBMS, connect to the specified SQL server.

close()

Reverse of open().

add(KEY, ARGV)

add KEY (primary key) or KEY and the associated VALUE into the object. ARGV is class dependent.

We assume an object is composed of a form. It is similar to RDBMS.

The primary key is a mail address. This assumption is correct in the case of mailing list driver. This is basic data structure.

delete(KEY)

Delete KEY and the associated VALUE.

find(KEY) / find(REGEXP)

Search data corresponding with the primary key within an object.

The target is specified as regular expression. Regular expression search is useful.

The return value is STR of ARRAY_REF (KEY => [ VALUE, VALUE2, VALUE3 ]).

get_next_key()

Return the list of primary keys like this:

while ($obj->get_next_key()) { ... }

This operation corresponds to FIRST_KEY() and NEXT_KEY() of perl hash.

[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .
Copyright (C) 1993-2022 Ken'ichi Fukamachi mail:< fukachan at fml.org >