Subject: | Error not quoting attribute names. |
Date: | Thu, 27 Sep 2018 12:20:02 -0400 |
To: | bug-MooseX-CustomInitArgs [...] rt.cpan.org |
From: | Stirling Westrup <swestrup [...] gmail.com> |
Using MooseX::CustomInitArgs version 0.004,I recently attempted to
define an attribute named 'foo-bar' only to get the error that 'foo'
was used as a bareword.
The relevant line from the (copious) error message was this:
$params->{"foo-bar"} =
$MxCIA_attrs{foo-bar}->_run_init_coderef($supplied[0], $class, $x);
For reference, the entire module definition was this:
package MyApp;
use namespace::autoclean;
use Moose;
use MooseX::CustomInitArgs;
has "foo-bar" =>
( is => 'rw'
, isa => 'Bool'
, default => 0
, init_args => [ 'no-foo-bar' => sub {not $1} ]
);
__PACKAGE__->meta->make_immutable;
1;
--
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