package My::New::OptionObject; use Moose; use Moose::Util::TypeConstraints; coerce 'My::New::OptionObject' from 'HashRef' via { My::New::OptionObject->new( %{ $_ }) }; has max_chunk => ( is=>'rw', isa=>'Int', init_arg => 'size', clearer=>'clear_max_chunk' ); has liberal_mode => ( is=>'rw', isa=>'Bool', default=>sub{1} ); has fh => ( is=>'rw', isa=>'My::New::Object::ProtoFileHandle', clearer=>'clear_fh', predicate=>'has_fh', writer=>'_set_fh', coerce => 1, init_arg => 'file', trigger => \&reset_temporary_variables ); package My::New::Object; use Moose; has options => ( is => 'ro', writer => 'set_all_options', isa => 'My::New::OptionObject', handles => [qw[ max_chunk liberal_mode fh ]], # and any others you might want ... coerce => 1, lazy => 1, clearer => 'clear_options', default => sub { My::New::OptionObject->new } ); #### my $o = My::New::Object->new( options => { ... pass in the args to the options here ... } ); #### $o->clear_options; #### $o->set_all_options( { ... } );