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::Config - Build Configuration from File or Reference

SYNOPSIS

    use Spreadsheet::Compare::Config {
        array   => sub { [] },
        hash    => sub { {} },
        param   => undef,
    }, make_attributes => 1, protected => 1;

    my $cfg = Spreadsheet::Compare::Config->new(from => 'test.yml');

DESCRIPTION

This modules is used to create attributes for the caller and keeps track of them, so that it can check, if the same attribute is used in another module.

It is also used for taking comparison configuration and expanding it with the defined default values and references. It creates an execution plan consisting of an array with all expanded configurations.

ATTRIBUTES

from

If used directly in the constructor, will call "load" directly with the attributes value. Using it as a setter attribute at a later stage has no effect.

globals

A reference to a hash with the expanded values of the __GLOBAL__ configuration section. Will be available after "load" was called.

plan

A reference to an array of hashes containing the expanded parameters for comparisons.

METHODS

load($source)

Load a configuration. Source can be a reference to a hash with a single comparison definition, a reference to an array with multiple definitions or a filename/filehandle of a YAML configuration file containing either.

next_test

Return the next test configuration (a reference to a hash). Will return undef once if the end is reached and restart at index 0 afterwards.