Subject: | Moo 2.002_000 breaks colon-in-accessor-names |
Prior to 2.002, the following worked:
{ package Hell; use Moo; has ':evil_name' => ( is => 'ro', lazy => 1, default => sub { return {} } ); }
After 2.002, the generated accessor tries to generate subs in a package called "Hell:"
and uh.
Magic Smoke in Code form leaks out.
Eval went very, very wrong: { my $_UNQUOTED = ${$_[1]->{"\$_UNQUOTED"}}; my $default_for__3aevil_5fname = ${$_[1]->{"\$default_for__3aevil_5fname"}}; my $_QUOTED = ${$_[1]->{"\$_QUOTED"}}; package Hell:; no warnings 'closure'; sub evil_name { ($_QUOTED,$_UNQUOTED) if 0; # BEGIN quote_sub PRELUDE package Method::Generate::Accessor::_Generated; BEGIN { $^H = 1762; ${^WARNING_BITS} = "UUUUUUUUUUUUUUUUU\001"; %^H = ( ); } # END quote_sub PRELUDE Carp::croak(":evil_name is a read-only accessor") if @_ > 1; exists $_[0]->{":evil_name"} ? $_[0]->{":evil_name"} : ($_[0]->{":evil_name"} = $default_for__3aevil_5fname->($_[0])) } $$_UNQUOTED = \&evil_name; } 1; Invalid version format (non-numeric data) at (eval 10) line 5, near "; package Hell" syntax error at (eval 10) line 5, near "package Hell:" BEGIN not safe after errors--compilation aborted at (eval 10) line 6. at /home/kent/perl5/perlbrew/perls/5.25.4-nossp-sdbm-nopmc/lib/site_perl/5.25.4/Method/Generate/Accessor.pm line 135.