$namespace->{$name} ||= *{ Symbol::gensym() };
if (@_ > 2) {
+ no warnings 'redefine';
*{ $namespace->{$name} } = ref $initial_value
? $initial_value : \$initial_value;
}
);
}
+{
+ my $warning;
+ local $SIG{__WARN__} = sub { $warning = $_[0] };
+ my $stash = Package::Stash->new('Bar');
+ $stash->add_symbol('&foo' => sub { });
+ $stash->add_symbol('&foo' => sub { });
+ is($warning, undef, "no redefinition warnings");
+}
+
done_testing;