Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'm enjoying the benefits of using Moose, and I wanted to enquire into some of the finer aspects of development with Moose.

Most of it is intuitive and very helpful. My compliments to the developers.

I have a couple of questions nonetheless:

I note that there exists both a trigger and a builder option. The trigger option, by use and testing has become clear. The builder option is somewhat similar, although it is passed as a scalar method name and not a coderef. Why a builder and a trigger option, and what are the finer points of the builder option? I ask as much to divine the intent of and the future direction of the design and development of Moose as for practical reasons.

as in:

has 'x' => (is => 'rw', isa => 'HashRef', builder => 'build_x'); has 'y' => (is => 'rw', isa => 'HashRef', trigger => \&y_trigger);

The trigger is as the docs say, "a CODE reference which will be called after the value of the attribute is set. The CODE ref will be passed the instance itself, the updated value and the attribute meta-object."

There is not too much information on builder in the Moose perldoc. Anyone care to elaborate?

Now for a more fun question. Metaclasses have been described as a solution in search of a problem. Anyone care to share any clever problems and solutions using Metaclasses in Moose?


In reply to Moose - nalia by doc_faustroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the monastery is silent...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (3)
    As of 2018-04-27 01:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?