Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Passing params, as a hash, to moose

by mbethke (Hermit)
on Oct 13, 2012 at 02:22 UTC ( #998814=note: print w/replies, xml ) Need Help??

in reply to Passing params, as a hash, to moose

That's a lot of work for the calling code. I'm not a Moose expert either but I'd use a BUILDARGS method, that's significantly shorter and cleaner already:

sub BUILDARGS { my ($class, %args) = @_; defined $args{colour} and '' ne $args{colour} or $args{colour} = ' +#123'; return \%args; }
Like this you only have to write the whole stuff once instead of once for every ->new

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998814]
Tanktalus is trying to figure out how to get a case-insensitive match between straße and strasse to return true in perl :( fc doesn't seem to do it, either, unless I'm doing it wrong.
[LanX]: ß,ss
[LanX]: nope
[LanX]: /.*(?:ß|ss).*/
[hippo]: How are you doing the match? Regex, index, eq or something else?

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2018-03-21 15:37 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (268 votes). Check out past polls.