diff --git a/lib/WebGUI/Definition.pm b/lib/WebGUI/Definition.pm index 9dcfa04c6..f28235172 100644 --- a/lib/WebGUI/Definition.pm +++ b/lib/WebGUI/Definition.pm @@ -43,10 +43,6 @@ sub import { my @propertyList; my %properties; if ( my $properties = delete $definition->{properties} ) { - # accept a hash and alphabetize it - if (ref $properties eq 'HASH') { - $properties = [ map { $_ => $properties->{$_} } sort keys %{ $properties } ]; - } for (my $i = 0; $i < @{ $properties }; $i += 2) { my $property = $properties->[$i]; push @propertyList, $property; @@ -109,7 +105,8 @@ sub import { *{$super . '::set'} = \&_set; *{$super . '::update'} = \&_update; *{$super . '::instantiate'} = \&_instantiate; - unshift @{$caller . '::ISA'}, $super; + @{$super . '::ISA'} = @{$caller . '::ISA'}; + @{$caller . '::ISA'} = ($super); return; } diff --git a/t/Definition.t b/t/Definition.t index 75883c1b2..0a9330a97 100644 --- a/t/Definition.t +++ b/t/Definition.t @@ -13,7 +13,7 @@ use warnings; no warnings qw(uninitialized); use Test::More 'no_plan'; #tests => 1; - +my $called_getProperties; { package WGT::Class; use WebGUI::Definition ( @@ -31,6 +31,12 @@ use Test::More 'no_plan'; #tests => 1; my $self = $class->instantiate; return $self; } + + sub getProperties { + $called_getProperties = 1; + my $self = shift; + return $self->next::method(@_); + } } my $written; @@ -80,8 +86,11 @@ is $subclass_object->property2, 'property 2 value', is_deeply [ $object->getProperties ], ['property1'], 'class has correct properties'; +ok $called_getProperties, 'able to override getProperties'; +undef $called_getProperties; is_deeply [ $subclass_object->getProperties ], ['property1', 'a_property', 'property2'], 'subclass has correct properties'; +ok $called_getProperties, 'subclass uses correctly overridden getProperties'; is_deeply $object->get, { property1 => 'property 1 value' }, 'get returns hash with correct properties';