Programming with Moose/Difficulties/Moose-w-Moose

After using Moose for a while you will eventually find yourself with an assortment of classes that you wish to reuse. Unfortunately, Moose won't make it all that easy to use those Moose classes from within Moose. Here are some difficult tasks to do within Moose:

In these examples, MooseObj, is a Moose object.
 * isa => ArrayRef[ MooseObj ]
 * There is no syntactic sugar to facilitate in creating MooseObj(s).
 * Not easily possible to coerce from.


 * isa => 'MooseObj'
 * No syntactic Autoboxing of the MooseObj, you can't do the following:.
 * No implicit way to bypass the creation of MooseObj and set its accessors. more on this in One-to-one Auto-vivification.

One-to-one Auto-vivification
What if you don't care about MooseObj, only the accessors inside? A child object might do no more than function as logical grouping for more accessors, as in the following example:

Even though Moose very well seeks to replace and abstract away a lot of perl's base-types here in comparison to having an Address hash it makes the job difficult. Here are some of the obvious difficulties:
 * You can not skip the step of creating a new Address object
 * The syntax, is not valid
 * The syntax  would be (assuming workAddress was a hash.)
 * You might wish for the component-class Address to require its child-attributes, but there is no way to later disable those, when the class is used as a child of another class.
 * The syntax  is not valid.
 * This wouldn't be all that useful in this case because of the like-problem with.

Proposed Solution
THIS SECTION IS BEING RE-WRITTEN Now obviously something nifty should happen to facilitate the creation of email. Any work done here would do a lot to further Moose's application into a Token-based system. Such as XML, where you can easily model, a one level tree in Moose, and then pull that into to another Moose class for a multiple level document. The following is pseudo-code that is not implemented.

Maybe there needs to be a set of AttributeHelpers for things that inherit from Moose::Object

Another way to accomplish this would be something like (provided by steven)

There are a few issues with this:
 * should be the value the  instead.
 * It doesn't accommodate for 's, that have , there must be some way to autovivify, or send constructor args.