You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to apply a role to a MooX::Press generated class which modifies has. Here's the role:
package VOTable::Order;
use v5.10;
use Moo::Role;
use Moo::_Utils;
use Role::Hooks;
Role::Hooks->after_apply(
__PACKAGE__,
sub {
my $class = $_[1];
say STDERR "After apply in $class";
Moo::_Utils::_install_modifier( $class, after => has => sub { say "$class\::has($_[0])" } );
}
);
1;
And here's the Moo::Xpress class:
package VOTable;
use v5.10;
use strict;
use warnings;
use MooX::Press (
prefix => __PACKAGE__,
'class:Field' => {
begin => sub {
my $class = shift;
Moo::Role->apply_roles_to_package( $class, 'VOTable::Order' );
},
has => ['id'],
},
);
1;
Here's a test class which is equivalent to the above generated one:
package VOTable::Snap;
use Moo;
with 'VOTable::Order';
has id => ( is => 'ro' );
1;
And here's what I get when I load the classes:
$ perl testlib/lib/perl5/VOTable.pm
After apply in VOTable::Field
$ plx perl testlib/lib/perl5/VOTable/Snap.pm
After apply in VOTable::Snap
VOTable::Snap::has(id)
I'm guessing it's not finding the modified version of has.
The text was updated successfully, but these errors were encountered:
That works for my case, but unfortunately it breaks tests:
t/91factoryroles-zylite.t ..... Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/91factoryroles.t ............ Undefined subroutine &MyApp::with called at /tmp/MooX-Press-0.086/lib/MooX/Press.pm line 1842.
BEGIN failed--compilation aborted at t/91factoryroles.t line 21.
t/91factoryroles.t ............ Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
I'd like to apply a role to a
MooX::Press
generated class which modifieshas
. Here's the role:And here's the
Moo::Xpress
class:Here's a test class which is equivalent to the above generated one:
And here's what I get when I load the classes:
I'm guessing it's not finding the modified version of
has
.The text was updated successfully, but these errors were encountered: