Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 117625
Status: rejected
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: porton [...] narod.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: An incompatibility with Moose
Date: Thu, 08 Sep 2016 17:24:13 +0300
To: bug-Moo [...] rt.cpan.org
From: Victor Porton <porton [...] narod.ru>
An incompatibility of Moo with Moose: From http://perlguru.com/gforum.cgi?post=83459;sb=post_latest_reply;so=ASC;forum_view=forum_view_collapsed;;page=unread#unread The following Perl code works with Moose but does not work (throws an exceptions) with Moo. #!/usr/bin/perl package X; use Moo; my $BusinessClass = "X"; my $Key = 'zz'; no strict 'refs'; *{"${BusinessClass}::access_$Key"} = sub { "Modified $Key" }; has $Key => ( is => 'rw', required => 0, accessor => { $Key => \&{"${BusinessClass}::access_$Key"} }, # predicate => { "has_$Key",\&{"${BusinessClass}::access2_$Key"} }, ); my $obj = X->new; print $obj->zz, "\n"; My real-life problem is how to generate classes whose fields are accessed through custom accessors. With Moose it can be accomplished by code like the above. But how to do this with Moo? Can we make Moo compatible with Moose about this issue?
Moo supports only a subset of Moose, generally ignoring things that are bad practice. Your Moose code is utterly stupid and #moose told you to *not* do it that way. Moo will not support you attempting to do the wrong thing. As such, I am rejecting this ticket.