I guess what you are really asking is 'how can I create a thread-local variable that is accessible from 'pre', 'do' and 'post'. Why are you not doing everything inside the 'do' function?
Comment on Re: Thread local variables in Thread::Pool::Simple
It didn't make a lot of sense to open and close a sqlite database handle for every job that comes through. I figured that each thread should have a sqlite handle that is persistent over the life of the thread.