Re: Sharing BUILDARGS() functionality.

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
On Jan 19, 2009, at 4:45 PM, Elliot Shank wrote:

> I've got various classes that I'm initializing based upon hashes  
> that come from configuration files.  The keys that come from the  
> files don't necessarily match the names of the attributes.  Simple  
> enough-- that's the type of thing that BUILDARGS() was created for.   
> But the question is how to share the BUILDARGS() implementation?  I  
> could get away with simple inheritance right now, but that doesn't  
> appeal.  Also, given that role composition order isn't guaranteed,  
> I'm not sure that a role is the long term solution either.  I'm  
> seriously thinking of simply creating an isolated function that does  
> the transformation and calling it in the place that I want in  
> BUILDARGS() on each class.

Have you looked at MooseX::MultiInitArg?

- Stevan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.