Force set to process properties in insertion order.

Note, we should look for a way to make this more efficient.
This commit is contained in:
Colin Kuskie 2009-12-18 15:28:10 -08:00
parent 8837185bce
commit 030f6bccf0
2 changed files with 39 additions and 3 deletions

View file

@ -86,9 +86,10 @@ is not an attribute of the object, then it is silently ignored.
sub set {
my $self = shift;
my $properties = @_ % 2 ? shift : { @_ };
KEY: for my $key ( keys %$properties ) {
next KEY unless $self->meta->find_attribute_by_name($key);
$self->$key($properties->{$key});
my @orderedProperties = $self->getProperties;
KEY: for my $property ( @orderedProperties ) {
next KEY unless exists $properties->{$property};
$self->$property($properties->{$property});
}
return 1;
}