package Objects::Status; { use Object::InsideOut; my @statuses :Field('Standard' => 'statuses', Type => 'Objects::StatusElement'); my %init_args :InitArgs = ( 'STATUSES' => { 'Type' => 'LIST', 'Field' => \@statuses, 'Default' => 'empty', }, ); sub init :Init { my ($self, $args) = @_; $self->set(\@statuses, foreach my $value (keys @$args->{'STATUSES'}){ Objects::StatusElement->new('Name' => $value); } } #### package Objects::StatusElement; { use Object::InsideOut; my @name :Field('Standard' => 'name'); my @status :Field('Standard' => 'status'); my @acknowledged :Field('Standard' => 'acknowledged'); my %init_args :InitArgs = ( 'NAME' => { 'Regex' => qr/^name$/i, 'Mandatory' => 1, 'Field' => \@name, }, 'STATUS' => { 'Regex' => qr/^status$/i, 'Default' => 'ERROR', 'Field' => \@status, }, 'ACKNOWLEDGED' => { 'Regex' => qr/^acknowledged$/i, 'Default' => 0, 'Type' => 'NUMERIC', 'Field' => \@acknowledged, }, ); } #### my $unitStatus = Objects::Status->new(statuses => ['DataFileFound', 'InfoFileFound', 'OtherStatus']); #### pushd @theObjectArray, Objects::StatusElement->new('Name' => 'DataFileFound'); pushd @theObjectArray, Objects::StatusElement->new('Name' => 'InfoFileFound'); pushd @theObjectArray, Objects::StatusElement->new('Name' => 'OtherStatus');