I am looking at the MetaModel in Pugs and trying to understand
In MetaModel.pm at the beginning there is an import function wherein the following subs are put in the name space
my $caller_pkg = caller(); # meta model helpers *{$caller_pkg . '::class'} = \&class; *{$caller_pkg . '::role'} = \&role; # instance attribute access helpers *{$caller_pkg . '::_'} = \&_; # class attribute access helpers *{$caller_pkg . '::__'} = \&__;
when the Object module is loaded the sub class in the Metamodel is called.

What happens when the below code is executed ?
also how does 2 parameters gets passed to the class method (name and params) ?
how do those subs with "DUMMY" get created

class 'Perl6::Object' => { 'class' => { methods => { # the default .new() 'new' => sub { my ($class, %params) = @_; return $class->bless(undef, %params); }, .... .... ## rest of the code

This gives the following in class ($name and $params)
name is Perl6::Object params is $VAR1 = { 'class' => { 'methods' => { 'CREATE' => sub { "DUMMY" }, 'bless' => sub { "DUMMY" }, 'isa' => sub { "DUMMY" }, 'new' => sub { "DUMMY" }, 'can' => sub { "DUMMY" } } }, 'instance' => { 'methods' => { 'isa' => $VAR1->{'class'}{'me +thods'}{'isa'}, 'DESTROYALL' => sub { "DUMMY" + }, 'BUILDALL' => sub { "DUMMY" } +, 'can' => $VAR1->{'class'}{'me +thods'}{'can'} }, 'submethods' => { 'BUILD' => sub { "DUMMY" } } } };


In reply to Perl6 MetaModel by mkirank

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, details, 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, summary, 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.