FlatFile::DataStore::Record - Perl module that implements a flatfile


FlatFile-DataStore documentation  | view source Contained in the FlatFile-DataStore distribution.

Index


NAME

Top

FlatFile::DataStore::Record - Perl module that implements a flatfile datastore record class.

SYNOPSYS

Top

 # 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

Top

FlatFile::DataStore::Record is a Perl module that implements a flatfile datastore 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

Top

FlatFile::DataStore::Record version 1.02

CLASS METHODS

Top

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, and new() will accept a scalar ref, e.g.,

 my $record_data = "This is a test record.";
 my $record = FlatFile::DataStore::Record->new( {
     preamble => $preamble_obj,
     data     => \$record_data,
     } );

OBJECT METHODS: Accessors

Top

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

Top

Brad Baxter, <bbaxter@cpan.org>

COPYRIGHT AND LICENSE

Top


FlatFile-DataStore documentation  | view source Contained in the FlatFile-DataStore distribution.