Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

MooseX::Declare not able to modify new() and BUILDARGS()

by llancet (Friar)
on May 28, 2010 at 05:46 UTC ( #841993=perlquestion: print w/replies, xml ) Need Help??

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?

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://841993]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2022-01-29 04:07 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (74 votes). Check out past polls.