Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How can a package knows which path it is in? For example, I have a "test.pm" in "/www/somedir": package test; sub currDIR { use Cwd; print getcwd(); } and then a "main.cgi" in "/www": require "./somedir/test.pm"; test::currDIR(); running main.cgi will print me "/www" (path to main.cgi), however, I a +ctually want "/www/somedir" (path to test.pm) instead, which command +should I use? I'm asking this because I need to open certain files i +n the package, and those files are stored in the same directory as th +e package for portability issues. Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: current path in a package?
by tilly (Archbishop) on Dec 28, 2010 at 06:41 UTC | |
by Anonymous Monk on Dec 28, 2010 at 07:44 UTC | |
|
Re: current path in a package?
by samarzone (Pilgrim) on Dec 28, 2010 at 08:06 UTC | |
by ELISHEVA (Prior) on Dec 28, 2010 at 08:34 UTC |