so that we can get Perl to detect cycles before MRO::Compat
spirals into an infinite loop (sartak)
- Reported by Schwern, [rt.cpan.org #39001]
+ - In create(), pass unused options on to initialize()
+ - added test for this
-0.66
+0.66 Sat September 20, 2008
!! This release has an incompatible change regarding !!
introspection of a class's method with Class::MOP::Class !!
t/045_metaclass_loads_classes.t
t/046_rebless_instance.t
t/047_rebless_with_extra_params.t
+t/048_anon_class_create_init.t
t/050_scala_style_mixin_composition.t
t/060_instance.t
t/061_instance_inline.t
eval $code;
confess "creation of $package_name failed : $@" if $@;
- my $meta = $class->initialize($package_name);
+ my (%initialize_options) = @args;
+ delete @initialize_options{qw(
+ package
+ superclasses
+ attributes
+ methods
+ version
+ authority
+ )};
+ my $meta = $class->initialize( $package_name => %initialize_options );
# FIXME totally lame
$meta->add_method('meta' => sub {
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use Class::MOP;
+
+{
+ package MyMeta;
+ use base 'Class::MOP::Class';
+ sub initialize {
+ my $class = shift;
+ my ( $package, %options ) = @_;
+ ::cmp_ok( $options{foo}, 'eq', 'this',
+ 'option passed to initialize() on create_anon_class()' );
+ return $class->SUPER::initialize( @_ );
+ }
+
+}
+
+my $anon = MyMeta->create_anon_class( foo => 'this' );
+isa_ok( $anon, 'MyMeta' );
+