NAME

FlatFile::DataStore::Record - Perl module that implements a flat file data store record class.

SYNOPSYS

# first, create a preamble object

use FlatFile::DataStore::Preamble;

my $preamble = FlatFile::DataStore::Preamble->new( {
    datastore => $ds,         # FlatFile::DataStore object
    indicator => $indicator,  # single-character crud flag
    transind  => $transind,   # single-character crud flag
    date      => $date,       # pre-formatted date
    transnum  => $transint,   # transaction number (integer)
    keynum    => $keynum,     # record sequence number (integer)
    reclen    => $reclen,     # record length (integer)
    thisfnum  => $fnum,       # file number (in base format)
    thisseek  => $datapos,    # seek position (integer)
    prevfnum  => $prevfnum,   # ditto these ...
    prevseek  => $prevseek,
    nextfnum  => $nextfnum,
    nextseek  => $nextseek,
    user      => $user_data,  # pre-formatted user-defined data
    } );

# then create a record object with the preamble contained in it

use FlatFile::DataStore::Record;

my $record = FlatFile::DataStore::Record->new( {
    preamble => $preamble,                 # i.e., a preamble object
    data     => "This is a test record.",  # actual record data
    } );

DESCRIPTION

FlatFile::DataStore::Record is a Perl module that implements a flat file data store record class. This class defines objects used by FlatFile::DataStore. You will likely not ever call new() yourself, (FlatFile::DataStore::create() would, e.g., do that) but you will likely call the accessors.

VERSION

FlatFile::DataStore::Record version 0.15

CLASS METHODS

FlatFile::DataStore::Record->new( $parms )

Constructs a new FlatFile::DataStore::Record object.

The parm $parms is a hash reference containing key/value pairs to populate the record string. Two keys are recognized:

- preamble, i.e., a FlatFile::DataStore::Preamble object
- data,     the actual record data

The record data is stored in the object as a scalar reference.

OBJECT METHODS: Accessors

The following read/write methods set and return their respective attribute values if $value is given. Otherwise, they just return the value.

$record->data(     $value ); # actual record data as a scalar ref
$record->preamble( $value ); # FlatFile::DataStore::Preamble object

The following read-only methods just return their respective values. The values all come from the record's contained preamble object.

$record->user()
$record->preamble_string()  # the 'string' attr of the preamble
$record->indicator()
$record->transind()
$record->date()
$record->transnum()
$record->keynum()
$record->reclen()
$record->thisfnum()
$record->thisseek()
$record->prevfnum()
$record->prevseek()
$record->nextfnum()
$record->nextseek()

$record->is_created()
$record->is_updated()
$record->is_deleted()

AUTHOR

Brad Baxter, <bbaxter@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Brad Baxter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.