Config-Model-Itself
view release on metacpan or search on metacpan
data/models/MasterModel.pl view on Meta::CPAN
default => 'yada yada'
},
a_string => {
type => 'leaf',
mandatory => 1,
value_type => 'string'
},
int_v => {
type => 'leaf',
value_type => 'integer',
default => '10',
min => 5,
max => 15
},
my_check_list => {
type => 'check_list',
refer_to => '- hash_a + ! hash_b',
},
'ordered_checklist' => {
type => 'check_list',
choice => [ 'A' .. 'Z' ],
ordered => 1,
help => { A => 'A help', E => 'E help' },
},
my_reference => {
type => 'leaf',
value_type => 'reference',
refer_to => '- hash_a + ! hash_b',
},
lot_of_checklist => {
type => 'node',
config_class_name => 'MasterModel::CheckListExamples',
},
warped_values => {
type => 'node',
config_class_name => 'MasterModel::WarpedValues',
},
warped_id => {
type => 'node',
config_class_name => 'MasterModel::WarpedId',
},
hash_id_of_values => {
type => 'node',
config_class_name => 'MasterModel::HashIdOfValues',
},
'deprecated_p' => {
type => 'leaf',
value_type => 'enum',
choice => [qw/cds perl ini custom/],
status => 'deprecated',
description =>
'deprecated_p is replaced by new_from_deprecated',
},
'new_from_deprecated' => {
type => 'leaf',
value_type => 'enum',
choice => [qw/cds_file perl_file ini_file custom/],
migrate_from => {
formula => '$replace{$old}',
variables => { old => '- deprecated_p' },
replace => {
perl => 'perl_file',
ini => 'ini_file',
cds => 'cds_file',
},
},
},
'old_url' => {
type => 'leaf',
value_type => 'uniline',
status => 'deprecated',
},
'host' => {
type => 'leaf',
value_type => 'uniline',
migrate_from => {
formula => '$old =~ m!http://([\w\.]+)!; $1 ;',
variables => { old => '- old_url' },
use_eval => 1,
},
},
'reference_stuff' => {
type => 'node',
config_class_name => 'MasterModel::References',
},
match => {
type => 'leaf',
value_type => 'string',
match => '^foo\d{2}$',
},
prd_match => {
type => 'leaf',
value_type => 'string',
grammar => q!token (oper token)(s?)
oper: 'and' | 'or'
token: 'Apache' | 'CC-BY' | 'Perl'
!,
},
warn_if => {
type => 'leaf',
value_type => 'string',
warn_if_match => { 'foo' => { fix => '$_ = uc;' } },
},
warn_unless => {
type => 'leaf',
value_type => 'string',
warn_unless_match =>
{ foo => { msg => '', fix => '$_ = "foo".$_;' } },
},
list_with_migrate_values_from => {
type => 'list',
cargo => {
type => 'leaf',
value_type => 'string'
},
migrate_values_from => '- lista',
},
hash_with_migrate_keys_from => {
type => 'hash',
index_type => 'string',
cargo => {
type => 'leaf',
value_type => 'string'
},
migrate_keys_from => '- hash_a',
},
assert_leaf => {
type => 'leaf',
value_type => 'string',
assert => {
assert_test => {
code => 'defined $_ and /\w/',
msg => 'must not be empty',
fix => '$_ = "foobar";'
}
},
},
leaf_with_warn_unless => {
type => 'leaf',
value_type => 'string',
warn_unless => {
warn_test => {
code => 'defined $_ and /\w/',
msg => 'should not be empty',
fix => '$_ = "foobar";'
}
},
},
'Source' => {
'value_type' => 'string',
'migrate_from' => {
'use_eval' => '1',
'formula' => '$old || $older ;',
undef_is => "''",
'variables' => {
'older' => '- Original-Source-Location',
'old' => '- Upstream-Source'
}
},
'type' => 'leaf',
},
[qw/Upstream-Source Original-Source-Location/] => {
'value_type' => 'string',
'status' => 'deprecated',
'type' => 'leaf'
},
(
map {
(
"list_with_"
. $_
. "_duplicates" => {
type => 'list',
duplicates => $_,
cargo => { type => 'leaf', value_type => 'string' }
},
);
} qw/warn allow forbid suppress/
),
],
description => [ tree_macro => 'controls behavior of other elements' ],
author => "dod\@foo.com",
copyright => "2011 dod",
license => "LGPL",
],
];
# do not put 1; at the end or Model-> load will not work
( run in 1.718 second using v1.01-cache-2.11-cpan-e1769b4cff6 )