Programming with Moose/Evolution of the Moose

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Your typical non-Moose program will undergo a series of changes as your understanding of Moose advances and you achieve the venerable rank of Moose elder:

  1. Dismantling the sub new {}
  2. Breaking apart the setters by using sub BUILD {}
  3. Removing sub new {} , sub BUILD {}

Your end result will be an application which delays most tasks until called for. You will find less of a need to use sub new {} because the very nature of it is more compile time than you will often require. That is to say, Moose will permit you to further fragment your monolithic new, into smaller tinier more manageable news that work when you try to retrieve information. This doesn't completely kill off the vanilla sub new {}, but it knocks off a big chuck of it.