Programming with Moose/Difficulties/Moose-w-Moose

From Wikibooks, open books for an open world
< Programming with Moose
Jump to navigation Jump to search

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[1] 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 $self->MooseObj( [{constructor_args1}, {constructor_args2}] ).
  • isa => 'MooseObj'
    • No syntactic Autoboxing of the MooseObj, you can't do the following: $self->foo->new( {constructor_args} ).
    • No implicit way to bypass the creation of MooseObj and set its accessors. more on this in One-to-one Auto-vivification.

YOUR WELCOME----------------------------------------------------------------NO PROBLEM

YOU HAVE BEEN HACKED

HEY FOLLOW @TIBS_IS_HERE ON INSTAGRAM PLEASE.