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' },
}
On 19 Jun 2008, at 00:35, Andy Armstrong wrote:
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 :)
Ah. I see:
http://search.cpan.org/dist/Class-AutoAccess/
But that creates accessor/mutators. I
# 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 =
Considering that Data::Dumper is entirely regular in how it will
present a deconstruction of the data structure, and you have a clear
concept of how you wish the example structure === accessor set thing
to work, it's certainly possible, and would take maybe two hacking
sessions to get right
On 19 Jun 2008, at 01:14, Eric Wilhelm wrote:
You want something like Object::Accessor, but without needing to
actually create the object?
Yup. I want a read-only object with dynamically generated per object
methods that reflect the internal data structure.
Assuming you could be bothered
On 19 Jun 2008, at 01:18, David Nicol wrote:
Considering that Data::Dumper is entirely regular in how it will
present a deconstruction of the data structure, and you have a clear
concept of how you wish the example structure === accessor set thing
to work, it's certainly possible, and would take
On Jun 18, 2008, at 6:35 PM, Andy Armstrong wrote:
I assume there's a module that works like this?
[snip]
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