NAME

Marlin::Util - exports a few keywords it's nice to have with Marlin

SYNOPSIS

use v5.20.0;
no warnings "experimental::signatures";

package Person {
  use Types::Common -lexical, -all;
  use Marlin::Util -lexical, -all;
  use Marlin
    'name'  => { is => ro, isa => Str, required => true },
    'age'   => { is => rw, isa => Int, predicate => true },
    -strict;
  
  signature_for introduction => (
    method   => true,
    named    => [ audience => Optional[InstanceOf['Person']] ],
  );
  
  sub introduction ( $self, $arg ) {
    say "Hi " . $arg->audience . "!" if $arg->has_audience;
    say "My name is " . $self->name . ".";
  }
}

DESCRIPTION

There are a few common values that often appear when defining attributes in Marlin (and Moo and Moose)! This module exports constants for them so they can be used as barewords.

If you add the -lexical export tag, everything will be exported as lexical keywords.

String constants for is

Export these with use Marlin::Util -attr or use Marlin::Util -all.

ro
rw
rwp
lazy
bare

Boolean constants

Export these with use Marlin::Util -bool or use Marlin::Util -all.

true
false

BUGS

Please report any bugs to https://github.com/tobyink/p5-marlin/issues.

SEE ALSO

This module uses Exporter::Tiny.

Marlin, Moose, Moo.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2025 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.