dimar has asked for the wisdom of the Perl Monks concerning the following question:
The special variable known as $0 works as desired when it is inside a script (eg, 'fooScript.pl'). However, when the happy camper retrofits his script code into a perl module (eg 'fooModule.pm'), the happy camper becomes sad. Why? Because $0 doesn't report the name of the *module*, it reports the name of the *calling script* (eg 'fooScriptThatHappensToUseFooModulePM.pl) .
The happy camper doesn't have a complaint with the way $0 works, that's sensible enough, but is there an alternative to $0? The happy camper wishes for a special variable that reports the name of the *perl module file* in which it is located. Is there such a thing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching for an alternative to $0
by Plankton (Vicar) on May 18, 2004 at 21:33 UTC | |
|
Re: Searching for an alternative to $0
by duff (Parson) on May 18, 2004 at 21:29 UTC | |
|
Re: Searching for an alternative to $0
by jmcnamara (Monsignor) on May 18, 2004 at 21:28 UTC | |
by Abigail-II (Bishop) on May 19, 2004 at 08:46 UTC | |
|
Re: Searching for an alternative to $0
by ambrus (Abbot) on May 18, 2004 at 21:53 UTC | |
|
Re: Searching for an alternative to $0
by zude (Scribe) on May 18, 2004 at 21:46 UTC | |
|
Re: Searching for an alternative to $0
by eserte (Deacon) on May 19, 2004 at 09:55 UTC |