Help language development. Donate to The Perl Foundation
StrictClass - Make your object constructors blow up on unknown attributes
use StrictClass;
class MyClass does StrictClass {
has $.foo;
has $.bar;
}
MyClass.new( :foo(1), :bar(2), :baz('makes you explode'));
Simply using this role for your class makes your new
"strict". This is a great way to catch small typos.
Martin Barth [email protected]
THANKS TO
* FCO aka SmokeMaschine from #perl6 IRC channel for this code.
* Dave Rolsky for his perl5 module `MooseX::StrictContructor`.
Copyright 2018 Martin Barth
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.