Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: pod2usage question

by SolidState (Scribe)
on May 08, 2005 at 12:27 UTC ( #454995=note: print w/replies, xml ) Need Help??

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...

Replies are listed 'Best First'.
Re^2: pod2usage question
by dwhitney (Beadle) on May 09, 2005 at 17:49 UTC
    The Big Reason(TM) for the BEGIN block is to allow for use'ing the MoveDataTools package in a dynamic way.
    For example, we don't really know where the user installed this script, but we do know where the libs were installed in relation to the script. The BEGIN block is there to help figure out the correct LIB path, based on the script's path.
    I am also trying to keep this seperate from the local perl install to avoid poluting it with extra stuff, that we don't really want to give global access to.
    This whole thing is really weird because it works fine on the Windows box I built this on, and except for the pod2usage call works fine on a linux machine as well.
    In any case, thank you all for your input on this!

      The BEGIN block is there to help figure out the correct LIB path, based on the script's path.

      The FindBin module might here you there. Check out the synopsys examples.

      Regarding the Pod::Usage problem, what happens if you move the "use Pod::Usage" line outside (before) the BEGIN block? Does that help?

      HTH :-)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://454995]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2023-04-02 12:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found