App-karr
view release on metacpan or search on metacpan
.claude/skills/perl-moo/SKILL.md view on Meta::CPAN
return ($args->{source});
}
sub BUILD { # runs AFTER all attributes are set; parentâchild order
my ($self, $args) = @_;
die "invalid" unless length $args->{source};
}
# DEMOLISH: childâparent order. Never override DESTROY directly.
```
Do NOT call `SUPER::BUILD` manually â Moo handles the chain.
---
## Pattern 10 â Strict Constructor
```perl
package StrictThing;
use Moo;
use MooX::StrictConstructor;
has size => (is => 'rw');
.claude/skills/perl-moo/SKILL.md view on Meta::CPAN
---
## Common Pitfalls
- `default => []` â **shared state bug**. Always `default => sub { [] }`.
- `extends 'A'; extends 'B'` â replaces, does NOT add B to A. Use `extends 'A', 'B'`.
- Imports after `use Moo::Role` are **composed into consumers** as methods.
- `namespace::autoclean` < 0.16 inflates Moo classes to Moose unexpectedly.
- `trigger` does NOT receive old value (unlike Moose).
- `Sub::HandlesVia` must be loaded *after* `use Moo`.
- `BUILD` chain is automatic; calling `SUPER::BUILD` manually breaks it.
- Never override `DESTROY`; use `DEMOLISH`.
( run in 2.335 seconds using v1.01-cache-2.11-cpan-98e64b0badf )