This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Carp: paranoid sub lookup
authorFather Chrysostomos <sprout@cpan.org>
Fri, 23 Aug 2013 07:50:40 +0000 (00:50 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 23 Aug 2013 07:50:40 +0000 (00:50 -0700)
commitf2ea74629375eafb0aec4965074eaf5ad9dbfe2b
tree75ffc96164929b9f93a2aea2d2c01e937ca4f0c9
parente708fa6e6e538adb6b46af045936a149c00d1e5c
Carp: paranoid sub lookup

Carp avoids autovivifying stashes when seeing whether a sub like
utf8::is_utf8 or overload::StrVal exists.

Its logic was slightly faulty, in that it did not take into account
that the existence of $::{"utf8::"} does not indicate the presence
of a typeglob in that element.  It could have been created due to
autovivification.  It also failed to take into account that $utf8::’s
HASH slot might be empty.  This would result in death.

In fixing this, I moved the common logic into a single function
and also took the opportunity to avoid multiple hash lookups in
a row.
dist/Carp/lib/Carp.pm
dist/Carp/t/vivify_stash.t