File: CheckListExamples.pl

package info (click to toggle)
libconfig-model-itself-perl 2.025-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 468 kB
  • sloc: perl: 3,507; makefile: 12
file content (76 lines) | stat: -rw-r--r-- 2,374 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

return [
    [
        name    => "MasterModel::CheckListExamples",
        element => [
            [qw/my_hash my_hash2 my_hash3/] => {
                type       => 'hash',
                index_type => 'string',
                cargo_type => 'leaf',
                cargo_args => { value_type => 'string' },
            },

            choice_list => {
                type   => 'check_list',
                choice => [ 'A' .. 'Z' ],
                help   => { A => 'A help', E => 'E help' },
            },

            choice_list_with_default => {
                type         => 'check_list',
                choice       => [ 'A' .. 'Z' ],
                default_list => [ 'A', 'D' ],
                help         => { A => 'A help', E => 'E help' },
            },

            choice_list_with_upstream_default_list => {
                type                  => 'check_list',
                choice                => [ 'A' .. 'Z' ],
                upstream_default_list => [ 'A', 'D' ],
                help                  => { A => 'A help', E => 'E help' },
            },

            macro => {
                type       => 'leaf',
                value_type => 'enum',
                choice     => [qw/AD AH/],
            },

            'warped_choice_list' => {
                type => 'check_list',
                warp => {
                    follow => '- macro',
                    rules  => {
                        AD => {
                            choice       => [ 'A' .. 'D' ],
                            default_list => [ 'A', 'B' ]
                        },
                        AH => { choice => [ 'A' .. 'H' ] },
                    }
                }
            },

            refer_to_list => {
                type     => 'check_list',
                refer_to => '- my_hash'
            },

            refer_to_2_list => {
                type     => 'check_list',
                refer_to => '- my_hash + - my_hash2   + - my_hash3'
            },

            refer_to_check_list_and_choice => {
                type => 'check_list',
                refer_to =>
                  [ '- refer_to_2_list + - $var', var => '- indirection ', ],
                choice => [qw/A1 A2 A3/],
            },

            indirection => { type => 'leaf', value_type => 'string' },

        ]
    ]
];