Re: Sharing BUILDARGS() functionality.

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
Oh, then that is easier I think.

Create a simple transformer function, put it into a role and have the  
appropriate classes consume it.

This (IMO) is the perfect use case for the horizontal reuse of roles  
because it allows you to inject commonly needed functionality into  
your classes without forcing some kind of convoluted inheritance  
relationship that does not accurately reflect your domain.

- Stevan

On Jan 19, 2009, at 8:40 PM, Elliot Shank wrote:

> Stevan Little wrote:
>> Have you looked at MooseX::MultiInitArg?
>
> That works for assigning specific names to specific attributes, but  
> doesn't address the thing that I'm going after, which is formulaic.   
> In my case, my BUILDARGS() makes the configuration keys case  
> insensitive and converts spaces to underscores so that a user can  
> give a value for the "system_dsn" attribute under the name "System  
> DSN" in the configuration.
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.