On Sat, Nov 21, 2015 at 8:01 PM, Chris Prather <perig...@prather.org> wrote:
> You are setting the superclasses explicitly so you're not inheriting from > Moose::Object which defines the hooks that call BUILDARGS. > Maybe I'm not following. The Catalyst code does this: > >> my $meta = Class::MOP::get_metaclass_by_name($class); >> $meta->superclasses($plugin, $meta->superclasses); >> > In this case $plugin = 'Catalyst::Plugin::MyPlugin', and $meta->superclasses = 'Catalyst'. Again, Catalyst extends Catalyst::Component, where BUILDARGS is defined. I'm not clear how MI is suppose to work, but what I'm seeing is BUILDARGS is now called in $plugin, and not in Catalyst::Component. By reversing the order like this: $meta->superclasses($meta->superclasses, $plugin); the BUILDARGS is called in Catalyst::Component and not in the $plugin. This is only an issue when the plugin uses Moose, but that's pretty common. Plugins written as roles are fine, of course. Oh, BTW -- the init_arg problem seems to be related to MooseX::Emulate::Class::Accessor::Fast. This code: package Foo; use Moose; use Data::Dumper; with 'MooseX::Emulate::Class::Accessor::Fast'; has foo => ( is => 'ro', isa => 'Int', # for error init_arg => undef, ); package main; use strict; use warnings; my $foo = Foo->new( { foo => 'bar' } ); use Data::Dumper; print Dumper $foo->foo; Generates this: $VAR1 = 'bar'; Which should not have been set -- and clearly isn't an Int. -- Bill Moseley mose...@hank.org