Subject: | ns:a bad peep hooking |
Date: | Wed, 5 Jan 2011 21:36:04 +0000 |
To: | bug-namespace-alias [...] rt.cpan.org |
From: | Zefram <zefram [...] fysh.org> |
namespace-alias-0.01 only passes its tests on 5.8.9 up to 5.10.1.
Upon examination, it turns out that this narrow range is largely due to
it having a copy of Perl_peep() from the core, which of course changes a
lot between Perl versions. However, ns:a actually has no need to copy
Perl_peep(): its copy is not modified, nor does ns:a actually need to
refer to the base peeper per se.
Very much relatedly, ns:a has a serious bug in how it uses the
PL_peepp hook: instead of its wrapper (peep_unstrict()) calling the
former PL_peepp, it unconditionally calls the copy of the base peeper.
Furthermore, the ->setup method overwrites PL_peepp every time it is run,
rather than only hooking once.
The attached patch fixes both of these issues. It makes ns:a cleanly add
itself to the peep hook chain, and drops the now-unneeded copy of the
base peeper. This makes ns:a pass its tests from 5.8.8 up to 5.11.1.
It still fails on 5.11.2 and above, where there is some other problem
that I'll examine shortly.
I also tried changing the Perl version requirement declared in alias.pm.
It was 5.8.8. Removing this restriction, ns:a passes its test suite all
the way down to 5.8.1. I don't see any reason why it wouldn't work on
these lower versions in a way that the test suite wouldn't notice. In
principle it might work on still lower versions, but B::Hooks::OP::Check
requires 5.8.1, so it would require some reworking. The attached patch
therefore reduces the declared Perl version requirement to 5.8.1.
-zefram
Message body is not shown because sender requested not to inline it.