Config-Model
view release on metacpan or search on metacpan
t/array_id.t view on Meta::CPAN
# -*- cperl -*-
use ExtUtils::testlib;
use Test::More;
use Test::Exception;
use Test::Differences;
use Test::Memory::Cycle;
use Test::Log::Log4perl;
use Config::Model;
use Config::Model::AnyId;
use strict;
use warnings;
use Config::Model::Tester::Setup qw/init_test/;
Test::Log::Log4perl->ignore_priority("info");
my ($model, $trace) = init_test();
my @element = (
# Value constructor args are passed in their specific array ref
cargo => {
type => 'leaf',
value_type => 'string'
},
);
# minimal set up to get things working
$model->create_config_class(
name => "Master",
gist => '@{olist} olist elts, @{plain_list} plain_list elts',
element => [
bounded_list => {
type => 'list',
class => 'Config::Model::ListId', # default
max => 123,
cargo => {
type => 'leaf',
value_type => 'string',
match => '^.{1,5}$',
},
},
plain_list => { type => 'list', @element },
list_with_auto_created_id => {
type => 'list',
auto_create_ids => 4,
@element
},
olist => {
type => 'list',
cargo => {
type => 'node',
config_class_name => 'Slave'
},
},
list_with_default_with_init_leaf => {
type => 'list',
default_with_init => {
0 => 'def_1 stuff',
1 => 'def_2 stuff'
},
@element,
},
list_with_default_with_init_node => {
( run in 0.693 second using v1.01-cache-2.11-cpan-39bf76dae61 )