|There's more than one way to do things|
On the dangers of too much debugging textby redlemon (Hermit)
|on Mar 28, 2008 at 13:39 UTC||Need Help??|
I'm using Catalyst to build an application, and are using the Catalyst::Controller::BindLex module to keep the code more readeable:
in stead of
This is all great stuff until you have:
The last line was there in the initial iteration of the action, the first line got added after some redesign.
Catalyst server started up as usual with a summary of actions, paths, plugins, and a lot of my own debug prints. The first notice something was wrong was when I got:
This sent me on a merry chase through all the internals using the debugger. Somehow BindLex saw a different address for $value than the one I saw in the debugger. After a couple of hours, lots of coffee, and some silly experiments I decided to take a shower and go to bed. It was after 5AM after all....
Somewhere between shower and bed it dawned on me. The reason BindLex was seeing a different address must be because there were 2 vars with the same name in the subroutine's scope!! So I went back and looked closely at the output of the server start again, and there it was, as the first line of output:
So, lessons learned: