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

Ixchel::Actions::sagan_include - Generates the instance specific include for a sagan instance.

VERSION

Version 0.2.0

CLI SYNOPSIS

ixchel -a sagan_include [--np] [-w] [-i <instance>]

CODE SYNOPSIS

    use Data::Dumper;

    my $results=$ixchel->action(action=>'sagan_include', opts=>{ w=>1, });

    print Dumper($results);

DESCRIPTION

Generates the Sagan include config.

The base include used is .sagan.config. If .sagan.multi_instance is set to 1, then .sagan.instances.$instance is merged on top of it using HASH::Merge with RIGHT_PRECEDENT as below with arrays being replaced.

``` { 'SCALAR' => { 'SCALAR' => sub { $_[1] }, 'ARRAY' => sub { [ $_[0], @{ $_[1] } ] }, 'HASH' => sub { $_[1] }, }, 'ARRAY' => { 'SCALAR' => sub { $_[1] }, 'ARRAY' => sub { [ @{ $_[1] } ] }, 'HASH' => sub { $_[1] }, }, 'HASH' => { 'SCALAR' => sub { $_[1] }, 'ARRAY' => sub { [ values %{ $_[0] }, @{ $_[1] } ] }, 'HASH' => sub { Hash::Merge::_merge_hashes( $_[0], $_[1] ) }, }, } ```

If told to write it out, .sagan.config_base is used as the base directory to write to with the file name being 'sagan-include.yaml' or in the case of multi instance "sagan-include-$instance.yaml".

.include is set to .sagan.config_base.'/sagan-rules.yaml' in the case of single instance setups if .sagan.multi_instance is set to 1 then .sagan.config_base."/sagan-rules-$instance.yaml"

FLAGS

-w

Write out the configs.

-i instance

A instance to operate on.

RESULT HASH REF

    .errors :: A array of errors encountered.
    .status_text :: A string description of what was done and teh results.
    .ok :: Set to zero if any of the above errored.