fml 8 tutorial
Prev | Chapter 45. IO Interface And Operations | Next

# 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.

Prev | Home | Next
IO Interface And Operations | Up | Discussion

fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
fml 4.0 project homepage is www.fml.org/software/fml4/.
about one floppy bsd routers, see www.bsdrouter.org/.
other free softwares are found at www.fml.org/software/.

author's homepage is www.fml.org/home/fukachan/.
Also, visit nuinui's world :) at www.nuinui.net.

For questions about FML, e-mail <fml-bugs@fml.org>.