NAME

XBase::Base - Base input output module for XBase suite

SYNOPSIS

Used indirectly, via XBase or XBase::Memo.

DESCRIPTION

This module provides catch-all I/O methods for other XBase classes, should be used by people creating additional XBase classes/methods. The methods return nothing (undef) or error and the error message can be retrieved using the errstr method. If the $XBase::Base::DEBUG variable is true, they also print the message on stderr, so the caller doesn't need to do this, just die or ignore the problem.

Methods are:

new

Constructor. Creates the object and if the file name is specified, opens the file.

open

Opens the file and using method read_header reads the header and sets the object's data structure. The read_header should be defined in the derived class, there is no default.

close

Closes the file, doesn't destroy the object.

get_record_offset

The argument is the number of the record, if returns the number

$header_len + $number * $record_len

using values from the object. Please note, that I use the term record here, even if in memo files the name block and in indexes page is more common. It's because I tried to unify the methods. Maybe it's a nonsense and we will drop this idea in the next version ;-)

seek_to_record

Seeks to record of given number.

seek_to

Seeks to given position. It undefs the tell value in the object, since it assumes the users that will do print afterwards would not update it.

read_record

Reads specified record from get_record_offset position. You can give second parameter saying length (in bytes) you want to read. The default is record_len. If the required length is -1, it will read record_len but will not complain if the file is shorter. Whis is nice on the end of memo file.

The method caches last record read. Also, when key unpack_template is specified in the object, it unpacks the string read and returns list of resulting values.

write_record, write_to

Writes data to specified record position or to the absolute position in the file.

VERSION

0.045

AUTHOR

(c) Jan Pazdziora, adelton@fi.muni.cz

SEE ALSO

perl(1), XBase(3)