Hi Monks!
I have a question which might be considered a "stylistic" issue but i thought i would get some insight.
Essentially i have a class which requires some configuration (read an XML file to decide how to handle incoming data)
Lots of objects are then created of that class using a data structure which can be fairly arbitrary
So basically, i'm musing over the problem of seperating the incoming data with configuration options. Something like
my $obj=class->new({config_file => "file.xml", data => \%some_yummy_da +ta});
Which doesn't seem very elegant to me. So i was thinking of handling it slightly differently:
my $factory=class->new({config_file => "file.xml"}); my $obj=$factory->give_me_my_object(\%data);
But then THAT seems weird since its essentially a factory returning objects of it's own class. And on top of that, it raises questions like what would happen if i tried to access "factory only" methods through the produced objects etc.
Any thoughts? Am i over complicating this?
Thanks as always for any help!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |