The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Spreadsheet::Compare::Record - Class Representing a Single Record

SYNOPSIS

    use Spreadsheet::Compare::Record;
    my $rec = Spreadsheet::Compare::Record->new(
        rec    => \@record,
        reader => $reader_object;
    );

DESCRIPTION

Spreadsheet::Compare::Record represents a single record read by one of the reader classes. It will normally be of little interest unless you are developing a new Reader class.

ATTRIBUTES

diff_info

A reference to a hash with summary information from the comparison with the corresponding record on the opposite side. Modification (don't do that) will also modify the corresponding record, the reference is shallow. It has the following structure:

    {
        ABS_FIELD => <name of the column with highest absolute deviation>,
        ABS_VALUE => <highest absolute deviation>,
        REL_FIELD => <name of the column with highest relative deviation>,
        REL_VALUE => <highest relative deviation>,
        limit     => <true if all deviations are below their configured limits>,
        equal     => <true if the records are considered equal>,
    };

h2i

hash

A hash value set by the reader. If the hash values for two record match, they are considered equal and no detailed comparisons will take place. This enhances performance significantly.

id

The id of the record constructed from the configuration value of "identity" in Spreadsheet::Compare::Reader

limit_mask

A reference to a hash with information from the comparison with the corresponding record on the opposite side. Modification (don't do that) will also modify the corresponding record, the reference is shallow. It has the following structure:

    {
        <columnindex> => [-1|0|1],
        ...
    }

with 0 means the values are equal, 1 means the values differ and -1 means they differ but the deviation is below the configured limits.

reader

The Spreadsheet::Compare::Reader object the record belongs to.

rec

A reference to an array with the record values.

side

A shortcut for $self->reader->side

side_name

A shortcut for $self->reader->side_name

sln

Source line number for the record, if the reader provides it (eg. file based readers).

METHODS

val($index)

Return the value at column index $index.