File: test_yaml_model.pl

package info (click to toggle)
libconfig-model-backend-yaml-perl 2.134-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 221; makefile: 2
file content (76 lines) | stat: -rw-r--r-- 1,691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# This file is part of Config-Model-Backend-Yaml
#
# This software is Copyright (c) 2018 by Dominique Dumont.
#
# This is free software, licensed under:
#
#   The GNU Lesser General Public License, Version 2.1, February 1999
#
# test model used by t/*.t

my @backend_config = (
    rw_config => {
        backend     => 'yaml',
        config_dir  => '/yaml/',
        file        => 'hosts.yml',
        auto_create => 1,
        full_dump => 0,
        auto_delete => 1,
    }
);

[
    {
        name => 'Host',

        element => [
            [qw/ipaddr canonical alias/] => {
                type       => 'leaf',
                value_type => 'uniline',
            },
            dummy => {qw/type leaf value_type uniline default toto/},
        ]
    },
    {
        name => 'Hosts',

        @backend_config,
        element => [
            record => {
                type  => 'list',
                cargo => {
                    type              => 'node',
                    config_class_name => 'Host',
                },
            },
        ]
    },
    {
        name => 'SingleHashElement',

        @backend_config,

        element => [
            record => {
                type  => 'hash',
                index_type => 'string',
                cargo => {
                    type              => 'node',
                    config_class_name => 'Host',
                },
            },
        ]
    },
    {
        name => 'TwoElements',
        include => 'SingleHashElement',
        @backend_config,
        element => [
            foo => {
                type => 'leaf',
                value_type => 'uniline',
            }
        ]
    }
];