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'
37 'wrapped doesn\'t die when $_ gets changed';
39 \%results, { base => 2, wrapped => 2 },
40 'saw expected calls to wrappers'
45 my $meta = Class::MOP::Class->create_anon_class(
46 superclasses => [ 'Base', 'Class::MOP::Object' ] );
47 for my $wrap (qw(before after)) {
48 my $alter = "add_${wrap}_method_modifier";
52 $_ = 'barf'; # 'barf' would replace the cached wrapper subref
58 my $o = $meta->get_meta_instance->create_instance;
63 ; # this would die with 'Can't use string ("barf") as a subroutine ref while "strict refs" in use'
65 'double-wrapped doesn\'t die when $_ gets changed';
67 \%results, { base => 2, wrapped => 4 },
68 'saw expected calls to wrappers'