http://qs321.pair.com?node_id=741694


in reply to Re: Mouse as prelude to Moose?
in thread Mouse as prelude to Moose?

By default Moose (and I'd assume also Mouse) will allow you to pass any keys you want to an object constructor. So what happens is just that the ks is being ignored. The reason it doesn't throw an error for an unknown key is so you can do something like this:

package Foo; use Moose; has 'number' => ( is => 'rw', isa => 'Num', ); sub BUILD { my ( $self, $args ) = @_; $self->number( $args->{ 'foo' } * 42 ); }

You can turn this behavior off for your own modules with MooseX::StrictConstructor.


www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!