# from Andy Armstrong
# on Wednesday 18 June 2008 16:35:

>use Data::Auto::Objectify::Thing qw( my_data_field );
>
>     sub new {
>         bless {
>             my_data_field => {
>                 foo => [ 1, 2, 3 ],
>                 bar => { eat => 'drink', sleep => 'wake' },
>...
>
>     my $two = $my_foo->foo( 1 );
>     my $eat = $my_foo->bar->eat;

You want something like Object::Accessor, but without needing to 
actually create the object?

Assuming you could be bothered to call new() for the sub-object (passing 
it to the contructor, etc), just about anything including Moose would 
work ;-)  I'll let the more Moose-enabled folks comment on how 
a 'default' sub (or some other setup) would do exactly what you want.

--Eric
-- 
"It ain't those parts of the Bible that I can't understand that
bother me, it's the parts that I do understand."
--Mark Twain
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to