The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mus - Mu but with slightly more typing and strict constructors

STATUS

Coverage Status

SYNOPSIS

  package Foo;
  use Mus;

  ro "hro";
  lazy hlazy => sub { 2 };
  rwp "hrwp";
  rw "hrw";

  my $foo = Foo->new(i_dont_exist => 5, hro => "exists", hrwp => "exists", hrw => "exists");

  # Found unknown attribute(s) passed to the constructor: i_dont_exist at (eval 30) line 52.
  #     Foo::new("Foo", "i_dont_exist", 5, "hro", "exists", "hrwp", "exists", "hrw", ...) called at Foo.pl line 9

DESCRIPTION

Mus imports both Mu and MooX::StrictConstructor making it even less work in typing and reading to set up an object with a strict constructor.

Mu::Role should still be used for roles, as strict constructors don't apply to roles, so I did not duplicate this.

AUTHOR

Adam Hopkins <srchulo@cpan.org>

COPYRIGHT

Copyright 2019- Adam Hopkins

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO