NAME Marlin::Antlers - a more Moose-like syntax for Marlin SYNOPSIS package Local::Widget 1.0 { use Marlin::Antlers; has name => ( is => rw, isa => Str, required => true, ); our $NEXT_ID = 1; has id => sub { $NEXT_ID++ }; sub dump ( $self ) { sprintf '%s[%d]', $self->name, $self->id; } } package Local::CoolWidget 1.0 { use Marlin::Antlers; extends 'Local::Widget 1.0'; } my $w = Local::CoolWidget->new( name => 'Foo' ); print $w->dump, "\n"; DESCRIPTION Marlin::Antlers provides Moose-like `has`, `extends`, etc keywords for Marlin. It also exports everything from Types::Common and Marlin::Util. This will give you `true`, `false`, `ro`, `rw`, `rwp`, etc for free, plus a whole bunch of type constraints, `signature_for`, etc. Everything is exported lexically. Marlin::Antlers also enables strict and warnings, plus switches on the following Perl features: signatures, postderef, lexical_subs, current_sub, evalbytes, fc, say, state, unicode_eval, and unicode_strings. It requires Perl 5.20, so you don't need to worry about whether modern Perl syntax features like `//` are supported. Significant differences from Moose and Moo are noted below. Keywords `has ATTRIBUTE => ( SPEC )` Much like Moose and Moo's `has` keyword, but defaults to `is => 'ro'`, so you don't get repetitive strain injury typing that out each time. Example: has foo => ( is => 'rw', isa => Int, clearer => true, predicate => true, lazy => true, default => 0, ); Note that it's possible to declare multiple attributes at the same time, as long as they share a spec. has [ 'foo', 'bar', 'baz' ] => ( is => 'rw', isa => Int, ); Moose and Moo allow that too! `has ATTRIBUTE => CODEREF` Shortcut for a lazy builder. Example: has foo => sub { 0 }; Moose and Moo don't allow that. `has ATTRIBUTE => TYPE` Shortcut for a read-only attribute with a type constraint. Example: has foo => Int; Moose and Moo don't allow that. `has ATTRIBUTE` Shortcut for a read-only attribute with no special options. Example: has "foo"; Moose and Moo don't allow that. `extends PARENTS` Set up inheritance for your class. Multiple inheritance is fine. Version numbers can be included. Example: extends "Local::BaseClass 1.0", "Local::SomeOtherClass"; Moose's syntax for including version numbers is slightly different. Moo doesn't allow version numbers to be included in the list. `with ROLES` Compose roles into your class. Example: with "Local::MyTrait 1.0", "Local::YourTrait"; Marlin doesn't allow you to alias or exclude methods like Moose does. Moose's syntax for including version numbers is slightly different. Moo doesn't allow version numbers to be included in the list. `before METHODNAME => CODEREF` Installs a "before" method modifier. See Class::Method::Modifiers. `after METHODNAME => CODEREF` Installs an "after" method modifier. See Class::Method::Modifiers. `around METHODNAME => CODEREF` Installs an "around" method modifier. See Class::Method::Modifiers. `fresh METHODNAME => CODEREF` Defines a method but complains if you're overwriting an inherited method. See Class::Method::Modifiers. Moose and Moo don't provide this keyword. `__FINALIZE__` You can call this function at the end of your class to finalize it. Think of it like Moose's `__PACKAGE__->meta->make_immutable`. However, Marlin::Antlers will automatically run it at the end of the lexical scope, so it is very rare you'd need to do it manually. (The only reason would be if you're defining several classes in the same file and don't want to wrap them in `{...}`.) Import Options You can customize your class using the following options: use Marlin::Antlers { sloppy => 1, constructor => 'create', x => [ ':Clone' ], }; The `sloppy` option turns off the strict constructor feature which is otherwise on by default. The `constructor` option allows you to name your class's constructor something other than "new". (A good use of that is to call it "_new" if you need to provide a wrapper for it.) The `x` option is used to load Marlin extensions. Each item on the array is an extension to load and can optionally be followed by a hashref of options to pass to the extension. BUGS Please report any bugs to . SEE ALSO Marlin::Role::Antlers. Marlin, Moose, Moo. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2026 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.