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

llancet has asked for the wisdom of the Perl Monks concerning the following question:

It seems that the predefined variable $self is required to be an Moose::Object. However, while around or after new(), the class name is given to $self, which does not satisfy the type constraint and produces an fatal error. How to solve that problem?
Thanks!

Replies are listed 'Best First'.
Re: MooseX::Declare not able to modify new() and BUILDARGS()
by zwon (Abbot) on May 28, 2010 at 09:55 UTC

    It would be good to see example. but generally you should use BUILD and BUILDARGS instead of modifying new. Also declare BUILDARGS as follows:

    method BUILDARGS (ClassName $class: ...) { ... }
    so it wouldn't complain about failed validation.