Moose and Test::Builder (was Tech Talk Slides)

Randy J. Ray rjray at blackperl.com
Wed Feb 1 19:30:22 GMT 2012


On 02/01/2012 06:31 AM, Mark Fowler wrote:
> Now I'm not sure what to suggest to do to fix it.  I'd normally just
> increase the number of stack frames that Test::Builder must look back
> through by using $Test::Builder::Level, but I didn't add the extra
> stack frames - Moose did.  I don't know how many stack frames Moose
> added and even if I were to find out, I wouldn't be able to guarantee
> that this number will be the same for all future or previous versions
> of Moose.  It would produce some very brittle code.
>
> Anyone got any ideas of what we should do?

I'm not very conversant on Moose, but from your description I would 
think that you want to manipulate $Test::Builder::Level within the 
"around" blocks for the delegated methods. You don't have any control 
over the mechanism that delegates, so you can't splice in there. But you 
can add such a line in the around-code. Of course, it will be brittle, 
as you say, because a subtle change in Moose internals could change the 
number of stack frames either in delegation or in the application of 
around-code. But that is the first thing I would try, at least.

Randy
-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray      Sunnyvale, CA      http://www.rjray.org 
rjray at blackperl.com

Silicon Valley Scale Modelers: http://www.svsm.org


More information about the london.pm mailing list