15 sub hey { $results{base}++ }
18 for my $wrap (qw(before after)) {
19 my $meta = Class::MOP::Class->create_anon_class(
20 superclasses => [ 'Base', 'Class::MOP::Object' ] );
21 my $alter = "add_${wrap}_method_modifier";
25 $_ = 'barf'; # 'barf' would replace the cached wrapper subref
30 my $o = $meta->get_meta_instance->create_instance;
35 ; # this would die with 'Can't use string ("barf") as a subroutine ref while "strict refs" in use'
36 }, undef, 'wrapped doesn\'t die when $_ gets changed' );
38 \%results, { base => 2, wrapped => 2 },
39 'saw expected calls to wrappers'
44 my $meta = Class::MOP::Class->create_anon_class(
45 superclasses => [ 'Base', 'Class::MOP::Object' ] );
46 for my $wrap (qw(before after)) {
47 my $alter = "add_${wrap}_method_modifier";
51 $_ = 'barf'; # 'barf' would replace the cached wrapper subref
57 my $o = $meta->get_meta_instance->create_instance;
62 ; # this would die with 'Can't use string ("barf") as a subroutine ref while "strict refs" in use'
63 }, undef, 'double-wrapped doesn\'t die when $_ gets changed' );
65 \%results, { base => 2, wrapped => 4 },
66 'saw expected calls to wrappers'