Config-Model
view release on metacpan or search on metacpan
t/value_compute.t view on Meta::CPAN
# -*- cperl -*-
use Test::More;
use Test::Differences;
use Test::Exception;
use Test::Memory::Cycle;
use Config::Model;
use Config::Model::Tester::Setup qw/init_test/;
use Test::Log::Log4perl;
use strict;
use warnings;
use 5.10.1;
my ($model, $trace, $args) = init_test('rd-hint','rd-trace');
note("use --rd-hint or --rd-trace options to debug Parse::RecDescent");
Test::Log::Log4perl-> ignore_priority('INFO');
$model->create_config_class(
name => "Slave",
element => [
find_node_element_name => {
type => 'leaf',
value_type => 'string',
compute => {
formula => '&element(-)',
},
},
location_function_in_formula => {
type => 'leaf',
value_type => 'string',
compute => {
formula => '&location',
},
},
check_node_element_name => {
type => 'leaf',
value_type => 'boolean',
compute => {
formula => '"&element(-)" eq "foo2"',
},
},
[qw/av bv/] => {
type => 'leaf',
value_type => 'integer',
compute => {
variables => { p => '! &element' },
formula => '$p',
},
},
Licenses => {
type => 'hash',
index_type => 'string',
cargo => {
type => 'node',
config_class_name => 'LicenseSpec'
}
},
] );
# Tx to Ilya Arosov
( run in 1.716 second using v1.01-cache-2.11-cpan-39bf76dae61 )