JayBonci has asked for the wisdom of the Perl Monks concerning the following question:
Hello kind monks,
Over at E2 I'm working on rewriting the object model to use Moose. This is slowly trying to change the tires on the car while it's moving. I'm still trying to dig in there, but my problem is that I don't know quite the right question to ask, so I thought I'd start here. This is a simplified example
Let's say I had a Moose Class like:
package MyApp::Object; use strict; use Moose; has 'greeting' => ('isa' => 'Str', 'is' => 'ro', 'required' => 1); 1;
For instance, what I want to do is create have MyApp::Object automatically create a MyApp::Object::Collection object which will contain an array of MyApp::Objects and when I call a parameter against it, it will loop through and call each of the MyApp::Object parameters. Additionally, I want this to be subclassable, so if MyApp::ChildObject comes along, that automatically creates MyApp::ChildObject::Collection. I'm a bit lost in the documentation on Moose::Meta, and am not quite sure what to google to continue. Does anyone have any pointers?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose::Meta programming and derivative classes
by choroba (Cardinal) on Apr 30, 2017 at 23:28 UTC | |
by JayBonci (Curate) on May 01, 2017 at 00:33 UTC | |
by Anonymous Monk on May 01, 2017 at 17:38 UTC |