in reply to pod2usage question
As others have pointed out, your problem seems to stem from the chdir command. Your solution involved placing yet more stuff into the BEGIN block where the chdir is.
My question is - why use a BEGIN block here in the first place? A BEGIN block is used when you want something to happen at compile time. In your case, you have "use" statements that take place anyway at compile time - so why place them in a BEGIN block? You also run a few other commands that may or may not benefit from being run at compile time - I can't tell. But from what I see, you would gain more clarity if you moved everything in the BEGIN block to the body of the program.
Just my 2 cents worth...
In Section Seekers of Perl Wisdom