The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Clarion - Perl extension for reading CLARION data files

ABSTRACT

This is a perl module to access CLARION 2.1 files. At the moment only read access to the files are provided by this package. "Encrypted" files are processed transparently, you do not need to specify the password of a file.

SYNOPSIS

        use Clarion;

        my $dbh=new Clarion "customer.dat";

        print $dbh->file_struct;

        for ( 1 .. $dbh->last_record ) {
        my $r=$dbh->get_record_hash($_);
                next if $r->{_DELETED};
            print $r->{CODE}." ".$r->{NAME}." ".$r->{PHONE}."\n";
        }

        $dbh->close();

DESCRIPTION

The various methods that are supported by this module are given below.

METHODS

$dbh=new Clarion;
$dbh=new Clarion "test.dat";

This will create an object $dbh that will be used to interact with the various methods the module provides. If file name is specified then associate the DAT file with the object. "Encrypted" files are processed transparently, you do not need to specify the password of a file.

$dbh->open("test.dat");

Associate the DAT file with the object, opens file.

@r=$dbh->get_record($_,@fields);
@r=$dbh->get_record($_);

Returns a list of data (field values) from the specified record. The first parameter in the call is the number of the physical record. If you do not specify any other parameters, all fields are returned in the same order as they appear in the file. You can also put list of field names after the record number and then only those will be returned. The first value of the returned list is always the logical (0 or not 0) value saying whether the record is deleted or not.

$r=$dbh->get_record_hash;

Returns reference to hash containing field values indexed by field names. The name of the deleted flag is _DELETED. The first parameter in the call is the number of the physical record. If you do not specify any other parameters, all fields are returned. You can also put list of field names after the record number and then only those will be returned.

$n=$dbh->last_record;

Returns the number of recods in the database file.

$n=$dbh->bof;

Returns the physical number of first logical record.

$n=$dbh->eof;

Returns the physical number of last logical record.

$dbh->close;

This closes the database file that are associated with the $dbh.

$struct = $dbh->file_struct;

This returns CLARION file structure.

EXPORT

None.

AUTHOR

Ilya Chelpanov <ilya@macro.ru> http://i72.narod.ru, http://i72.by.ru

SEE ALSO

Clarion data files and indexes description at http://i72.by.ru.