在Perl5和Moose中,線性isa或線性化isa有助於理解類層次結構。 WHAT顯示具體類型的值的方法: > 42.WHAT
(Int)
我如何顯示類似 > 42.hypothetical-type-hierarchy
(Int) ┬ is (Cool) ─ is (Any) ─ is (Mu)
└ does (Real) ─ does (Numeric)
...可能進
我有了一個木::角色(除其他事項外): package My::Role;
use strict;
use warnings;
use Moose::Role;
use MooseX::ClassAttribute;
class_has table => (
is => 'ro'
isa => 'Str',
lazy => 1,
);
has id
我想一元編程轉換應用於一些我的課,讓我們加入printXxx方法,這樣說: class Person {
String name
}
def p = new Person()
p.printName() // does something
我有一個粗略的想法如何可以做到這一點,一旦我有一個元類: Person.metaClass.methodMissing = { name,