3 ms·
has foo => (is => 'rw', required => 1); has bar => (is => 'ro', lazy => 1, builder => '_build_bar'); sets up both accessors and the relevant constructor lo
by mst 12y ago
has foo => (is => 'rw', required => 1);
has bar => (is => 'ro', lazy => 1, builder => '_build_bar');
sets up both accessors and the relevant constructor logic - and bar's accessor will call the _build_bar method on self to get the value if it wasn't provided to the constructor.
Method modifiers (before/after/around) are way more elegant than rename-the-method, and compose nicely from roles - and roles are substantially more powerful than mixins.