I assume there's a module that works like this?
package MyFoo;
use Data::Auto::Objectify::Thing qw( my_data_field );
sub new {
bless {
my_data_field => {
foo => [ 1, 2, 3 ],
bar => { eat => 'drink', sleep => 'wake' },
}
},
shift;
}
package main;
my $my_foo = MyFoo->new;
my $two = $my_foo->foo( 1 );
my $eat = $my_foo->bar->eat;
In other words I want it to synthesise accessors based on the contents
of a complex data structure. For bonus points it might also allow
# Can use subscript notation for hashes
my $eat = $my_foo->bar('eat');
And maybe allow multiple subscripts so that, for example, if I had a
field called 'grid' that contained a rectangular array I could then do
my $point = $my_bar->grid(3, 5);
It's got to exist, right? I had a look but there are so many
^(?:Object|Data)::.* modules that it's a bit hard to see the wood for
the trees :)
--
Andy Armstrong, Hexten