http://www.perlmonks.org?node_id=477815

mkirank has asked for the wisdom of the Perl Monks concerning the following question:

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" } } } };