Moose 程式設計/語法
外觀
迄今為止,CPAN 文件的一個重大問題是,它們利用(濫用)了 Moose 是 Class::MOP 應用程式的事實。Class::MOP 是元物件協議構建框架 - 通常從這裡開始就會變得難以理解。Class::MOP 和 Moose 之間存在非常模糊的界限,因為 Moose 是 Class::MOP 的唯一已知應用程式。
本質上,我們在 Class::MOP 中擁有的是一個允許 Moose 簡潔且非 Perl 風格的技巧存檔。Moose 提供了一些這些技巧,但沒有多少糖衣,但通常會將它們糖衣到一個舒適的程度。
在這個 Moose 語法綱要中,我們承諾不再提及 Class::MOP。[1]
使用 use Moose; 匯出的關鍵字
15:32 <@konobi> less shit to track during runtime
15:33 <@Sartak> EvanCarroll: my $person = Person->new; $person->has("jewelry")
15:33 <@konobi> just _having_ stuff in your namespace will slow the interpreter down
15:33 <@Sartak> if you keep Moose's functions in Person's namespace, that will have weird results
15:33 <@Sartak> if you no Moose, then it's the usual "undefined function" error
^ Class::MOP,最後一次,我發誓。