]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/error_handlers_with_gettext_can_clobber___36____64__.mdwn
clarify which case fails
[ikiwiki.git] / doc / bugs / error_handlers_with_gettext_can_clobber___36____64__.mdwn
1 [[!template id=gitbranch branch=smcv/ready/careful-eval author="[[smcv]]"
2   browse="http://git.pseudorandom.co.uk/smcv/ikiwiki.git/shortlog/refs/heads/ready/careful-eval"]]
3 [[!tag patch]]
4
5 As noted in the [[!cpan Try::Tiny]] man page, eval/$@ can be quite
6 awkward in corner cases, because $@ has the same properties and problems
7 as C's errno. While writing a regression test for definetemplate
8 in which it couldn't find an appropriate template, I received
9     
10     <span class="error">Error: failed to process template
11     <span class="createlink">deftmpl</span> </span>
12     
13 instead of the intended
14     
15     <span class="error">Error: failed to process template
16     <span class="createlink">deftmpl</span> template deftmpl not
17     found</span>
18     
19 which turned out to be because the "catch"-analogous block called
20 gettext before it used $@, and gettext can call define_gettext,
21 which uses eval.
22
23 Fixed in my branch smcv/ready/careful-eval. Another possibility
24 for fixing this would be to depend on something like Try::Tiny,
25 which is already indirectly recommended by ikiwiki, because
26 [[!cpan RPC::XML]], [[!cpan XML::Feed]], etc., depend on it.
27 --[[smcv]]
28
29 [[fixed in 3.20140227|done]] --s