Config-Model
view release on metacpan or search on metacpan
lib/Config/Model/AnyId.pm view on Meta::CPAN
# suggest => 'foo' or '$bar foo'
# creates a method analog to next_id (or next_id but I need to change
# run_user_command) that suggest the next id as foo_<nb> where
# nb is incremented each time, or compute the passed formula
# and performs the same
my @common_int_params = qw/min_index max_index max_nb auto_create_ids/;
has \@common_int_params => ( is => 'ro', isa => 'Maybe[Int]' );
my @common_hash_params = qw/default_with_init/;
has \@common_hash_params => ( is => 'ro', isa => 'Maybe[HashRef]' );
my @common_list_params = qw/allow_keys default_keys auto_create_keys/;
has \@common_list_params => (
is => 'ro',
isa => 'KeyArray',
coerce => 1,
default => sub { []; }
);
my @common_str_params = qw/allow_keys_from allow_keys_matching follow_keys_from
lib/Config/Model/AnyId.pm view on Meta::CPAN
my @allowed_warp_params = ( @common_params, qw/level convert/ );
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
my %args = @_;
my %h = map { ( $_ => $args{$_} ); } grep { defined $args{$_} } @allowed_warp_params;
return $class->$orig( backup => dclone( \%h ), @_ );
};
has [qw/backup cargo/] => ( is => 'ro', isa => 'HashRef', required => 1 );
has warp => ( is => 'ro', isa => 'Maybe[HashRef]' );
has [qw/morph/] => ( is => 'ro', isa => 'Bool', default => 0 );
has content_warning_list => ( is => 'rw', isa => 'ArrayRef', default => sub { []; } );
has [qw/cargo_class max_index index_class index_type/] =>
( is => 'rw', isa => 'Maybe[Str]' );
has config_model => (
is => 'ro',
isa => 'Config::Model',
weak_ref => 1,
lazy => 1,
lib/Config/Model/IdElementReference.pm view on Meta::CPAN
use Carp;
use Config::Model::ValueComputer;
use Log::Log4perl qw(get_logger :levels);
my $logger = get_logger("Tree::Element::IdElementReference");
# config_elt is a reference to the object that called new
has config_elt => ( is => 'ro', isa => 'Config::Model::AnyThing', required => 1, weak_ref => 1 );
has refer_to => ( is => 'ro', isa => 'Maybe[Str]' );
has computed_refer_to => ( is => 'ro', isa => 'Maybe[HashRef]' );
sub BUILD {
my $self = shift;
my $found = scalar grep { defined $self->$_; } qw/refer_to computed_refer_to/;
if ( not $found ) {
Config::Model::Exception::Model->throw(
object => $self->config_elt,
message => "missing " . "refer_to or computed_refer_to parameter"
lib/Config/Model/Value.pm view on Meta::CPAN
has [qw/write_as/] => ( is => 'rw', isa => 'Maybe[ArrayRef]' );
has [qw/refer_to _data replace_follow/] => ( is => 'rw', isa => 'Maybe[Str]' );
has value_type => ( is => 'rw', isa => 'ValueType' );
my @common_int_params = qw/min max mandatory /;
has \@common_int_params => ( is => 'ro', isa => 'Maybe[Int]' );
my @common_hash_params = qw/replace assert warn_if_match warn_unless_match warn_if warn_unless help/;
has \@common_hash_params => ( is => 'ro', isa => 'Maybe[HashRef]' );
my @common_list_params = qw/choice/;
has \@common_list_params => ( is => 'ro', isa => 'Maybe[ArrayRef]' );
my @common_str_params = qw/default upstream_default convert match grammar warn/;
has \@common_str_params => ( is => 'ro', isa => 'Maybe[Str]' );
my @warp_accessible_params =
( @common_int_params, @common_str_params, @common_list_params, @common_hash_params );
my @allowed_warp_params = ( @warp_accessible_params, qw/level help/ );
my @backup_list = ( @allowed_warp_params, qw/migrate_from/ );
lib/Config/Model/ValueComputer.pm view on Meta::CPAN
# value_object is mostly used for error messages
has value_object => (
is => 'ro',
isa => 'Config::Model::AnyThing',
required => 1,
weak_ref => 1,
handles => [qw/grab grab_value location index element/],
);
has variables => ( is => 'ro', isa => 'HashRef', default => sub { {} } );
has replace => ( is => 'ro', isa => 'HashRef', default => sub { {} } );
has [qw/use_eval allow_override use_as_upstream_default/] =>
( is => 'ro', isa => 'Bool', default => 0 );
has allow_user_override => (
is => 'ro',
isa => 'Bool',
lazy => 1,
builder =>
sub { my $self = shift; return $self->allow_override || $self->use_as_upstream_default; } );
lib/Config/Model/Warper.pm view on Meta::CPAN
use Mouse;
use Log::Log4perl qw(get_logger :levels);
use Data::Dumper;
use Storable qw/dclone/;
use Config::Model::Exception;
use List::MoreUtils qw/any/;
use Carp;
has 'follow' => ( is => 'ro', isa => 'HashRef[Str]', required => 1 );
has 'rules' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'warped_object' => (
is => 'ro',
isa => 'Config::Model::AnyThing',
handles => ['needs_check'],
weak_ref => 1,
required => 1
);
has '_values' => (
( run in 0.743 second using v1.01-cache-2.11-cpan-5f2e87ce722 )