Subject: | Feature Request. |
Date: | Fri, 21 Sep 2018 11:53:47 -0400 |
To: | bug-MooseX-CustomInitArgs [...] rt.cpan.org |
From: | Stirling Westrup <swestrup [...] gmail.com> |
I recently came across the MooseX::CustomInitArgs package, and it
solves a problem I'm having, in that I have a number of boolean
attributes in a constructor that I wish to support being set as
negations. ie, I'll have the attributes 'foo', 'bar', and 'baz' as
well as 'no-foo', 'no-bar', 'no-baz', which store into the same three
values.
It would be nice however if there were some way to provide a regex or
other pattern so that I could write something like:
has [qw(foo bar baz)] => (
is => 'rw',
isa => 'Bool',
default => 0,
init_args => [ /^no-/ => sub { not $_ } ]
);
Whether or not you think its worth putting in this feature I wish to
thank you for the work you've already done, as its simplified my
coding efforts already.
--
Stirling Westrup
Programmer, Entrepreneur.
https://www.linkedin.com/e/fpf/77228
http://www.linkedin.com/in/swestrup
http://technaut.livejournal.com
http://sourceforge.net/users/stirlingwestrup