Ported some methods including add_model_object() and apply_config() to XS

This commit is contained in:
Alessandro Ranellucci 2014-11-09 12:25:59 +01:00
parent 6b4015f9ac
commit 3e4c572164
14 changed files with 312 additions and 254 deletions

View file

@ -174,19 +174,6 @@ sub _handle_legacy {
return ($opt_key, $value);
}
sub set_ifndef {
my $self = shift;
my ($opt_key, $value, $deserialize) = @_;
if (!$self->has($opt_key)) {
if ($deserialize) {
$self->set_deserialize($opt_key, $value);
} else {
$self->set($opt_key, $value);
}
}
}
sub as_ini {
my ($self) = @_;
@ -213,23 +200,6 @@ sub setenv {
}
}
sub equals {
my ($self, $other) = @_;
return @{ $self->diff($other) } == 0;
}
# this will *ignore* options not present in both configs
sub diff {
my ($self, $other) = @_;
my @diff = ();
foreach my $opt_key (sort @{$self->get_keys}) {
push @diff, $opt_key
if $other->has($opt_key) && $other->serialize($opt_key) ne $self->serialize($opt_key);
}
return [@diff];
}
# this method is idempotent by design and only applies to ::DynamicConfig or ::Full
# objects because it performs cross checks
sub validate {