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:
Like this you only have to write the whole stuff once instead of once for every ->newsub BUILDARGS { my ($class, %args) = @_; defined $args{colour} and '' ne $args{colour} or $args{colour} = ' +#123'; return \%args; }
In reply to Re: Passing params, as a hash, to moose
by mbethke
in thread Passing params, as a hash, to moose
by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |