![]() |
![]()
| ![]() |
![]()
DESCRIPTIONTo define a new data transfer object (DTO) simply say: package OpenXPKI::Client::UI::Response::MyData; use OpenXPKI::Client::UI::Response::DTO; has 'message' => ( is => 'rw', isa => 'Str', ); has_dto 'menu' => ( documentation => 'structure', class => 'OpenXPKI::Client::UI::Response::Menu', ); This will modify your package as follows:
has_dtoStatic method: shortcut to define DTO attributes in Moose with less overhead: has_dto 'menu' => ( documentation => 'structure', # key name in result hash will be "structure" instead of "menu" class => 'OpenXPKI::Client::UI::Response::Menu', ); is equivalent to: has 'menu'=> ( documentation => 'structure', is => 'rw', isa => 'OpenXPKI::Client::UI::Response::Menu', default => sub { OpenXPKI::Client::UI::Response::Menu->new }, lazy => 1, );
|