__DATA__ require Moose; my $meta = bless( { __immutable => { inlined_methods => [ bless( { _expected_method_class => "Moose::Object", associated_metaclass => undef, attributes => [ undef ], body => undef, meta_instance => bless( { associated_metaclass => undef, attributes => [ bless( { accessor => "foo", associated_class => undef, associated_methods => [ bless( { accessor_type => "accessor", associated_metaclass => undef, attribute => undef, body => undef, definition_context => { description => "accessor foo", file => "/home/matthewt/wdir/MooseX-Antlers/lib/MooseX/Antlers/Compiler.pm", line => 39, package => "MooseX::Antlers::Compiler" }, is_inline => undef, name => "foo", package_name => "One" }, 'Moose::Meta::Method::Accessor' ) ], definition_context => { file => "/home/matthewt/wdir/MooseX-Antlers/lib/MooseX/Antlers/Compiler.pm", line => 39, package => "MooseX::Antlers::Compiler" }, init_arg => "foo", insertion_order => 0, is => "rw", name => "foo", required => 1, trigger => undef }, 'Moose::Meta::Attribute' ) ], slot_hash => { foo => undef }, slots => [ "foo" ] }, 'Moose::Meta::Instance' ), name => "new", options => { constructor_class => "Moose::Meta::Method::Constructor", constructor_name => "new", debug => 0, destructor_class => "Moose::Meta::Method::Destructor", immutable_trait => "Moose::Meta::Class::Immutable::Trait", inline_accessors => 0, inline_constructor => 1, inline_destructor => 1 }, package_name => "One" }, 'Moose::Meta::Method::Constructor' ), bless( { associated_metaclass => undef, body => undef, name => "DESTROY", options => { constructor_class => "Moose::Meta::Method::Constructor", constructor_name => "new", debug => 0, destructor_class => "Moose::Meta::Method::Destructor", immutable_trait => "Moose::Meta::Class::Immutable::Trait", inline_accessors => 0, inline_constructor => 1, inline_destructor => 1 }, package_name => "One" }, 'Moose::Meta::Method::Destructor' ) ], options => { constructor_class => "Moose::Meta::Method::Constructor", constructor_name => "new", debug => 0, destructor_class => "Moose::Meta::Method::Destructor", immutable_trait => "Moose::Meta::Class::Immutable::Trait", inline_accessors => 0, inline_constructor => 1, inline_destructor => 1 }, original_class => "Moose::Meta::Class" }, _meta_instance => undef, _methods => {}, attribute_metaclass => "Moose::Meta::Attribute", attributes => { foo => undef }, authority => undef, constructor_class => "Moose::Meta::Method::Constructor", constructor_name => "new", dependent_meta_instances => [], destructor_class => "Moose::Meta::Method::Destructor", error_class => "Moose::Error::Default", immutable_trait => "Moose::Meta::Class::Immutable::Trait", instance_metaclass => "Moose::Meta::Instance", method_metaclass => "Moose::Meta::Method", methods => { DESTROY => undef, foo => undef, get_called_foo => bless( { associated_metaclass => undef, body => undef, name => "get_called_foo", package_name => "One" }, 'Moose::Meta::Method' ), meta => bless( { associated_metaclass => undef, body => undef, name => "meta", package_name => "One" }, 'Moose::Meta::Method' ), new => undef }, namespace => undef, package => "One", role_applications => [], roles => [], superclasses => \undef, version => undef, wrapped_method_metaclass => "Class::MOP::Method::Wrapped" }, 'Class::MOP::Class::Immutable::Moose::Meta::Class' ) ; # fixup code for external references $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"associated_metaclass"} = $meta; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"attributes"}->[0] = $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"body"} = \&One::new; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"associated_metaclass"} = $meta; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_class"} = $meta; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]->{"associated_metaclass"} = $meta; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]->{"attribute"} = $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]->{"body"} = \&One::foo; $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"trigger"} = $has_args{"foo"}->[6]; $meta->{"__immutable"}->{"inlined_methods"}->[1]->{"associated_metaclass"} = $meta; $meta->{"__immutable"}->{"inlined_methods"}->[1]->{"body"} = \&One::DESTROY; $meta->{"_meta_instance"} = $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}; $meta->{"attributes"}->{"foo"} = $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]; $meta->{"authority"} = $meta->{"superclasses"}; $meta->{"methods"}->{"DESTROY"} = $meta->{"__immutable"}->{"inlined_methods"}->[1]; $meta->{"methods"}->{"foo"} = $meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]; $meta->{"methods"}->{"get_called_foo"}->{"associated_metaclass"} = $meta; $meta->{"methods"}->{"get_called_foo"}->{"body"} = \&One::get_called_foo; $meta->{"methods"}->{"meta"}->{"associated_metaclass"} = $meta; $meta->{"methods"}->{"meta"}->{"body"} = \&One::meta; $meta->{"methods"}->{"new"} = $meta->{"__immutable"}->{"inlined_methods"}->[0]; $meta->{"namespace"} = $meta->{"superclasses"}; $meta->{"version"} = $meta->{"superclasses"}; # fixup code for weak references use Scalar::Util (); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[0]->{"associated_metaclass"}); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"associated_metaclass"}); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_class"}); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]->{"associated_metaclass"}); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[0]->{"meta_instance"}->{"attributes"}->[0]->{"associated_methods"}->[0]->{"attribute"}); Scalar::Util::weaken($meta->{"__immutable"}->{"inlined_methods"}->[1]->{"associated_metaclass"}); Scalar::Util::weaken($meta->{"methods"}->{"get_called_foo"}->{"associated_metaclass"}); Scalar::Util::weaken($meta->{"methods"}->{"meta"}->{"associated_metaclass"}); Class::MOP::store_metaclass_by_name("One" => $meta); no warnings 'redefine'; *One::meta = sub { Moose::Meta::Class->initialize( ref($_[0]) || $_[0] ); }; $meta;