7 package Without::Overloading;
8 sub new { bless {}, shift }
10 package With::Overloading;
11 use base 'Without::Overloading';
12 use overload q{""} => sub { "overloaded" };
15 my $without = bless {}, "Without::Overloading";
16 like("$without", qr/^Without::Overloading/, "no overloading");
18 my $with = With::Overloading->new;
19 is("$with", "overloaded", "initial overloading works");
22 my $meta = Class::MOP::Class->initialize('With::Overloading');
24 $meta->rebless_instance($without);
25 is("$without", "overloaded", "overloading after reblessing works");