[tpm] Detect a module's directory
Shaun Fryer
sfryer at sourcery.ca
Mon Feb 22 12:18:30 PST 2010
if the code will be in the module itself, I believe (IIRC) the
__FILE__ pragma will do the trick. you just need to strip off the
filename and voila!
hope that helps.
--
Shaun Fryer
On Mon, Feb 22, 2010 at 2:28 PM, Digimer <linux at alteeve.com> wrote:
> Hi all,
>
> Possibly stupid question time...
>
> Is there a reliable* way to detect or read the directory that a perl module
> is in? '$ENV{PWD}' returns the directory of the script loading the module,
> not of the module itself. My Google-fu is failing me as finding a solution,
> too.
>
> The reason I need this is that my core module reads in a configuration file
> from the root of the module's directory. I could hard-code it, but I would
> rather it be flexible in case it gets moved down the road.
>
> Thanks!
>
> Madi
>
> *Reliable in that it'd work when run from cron, work if/when the module is
> moved, etc.
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
More information about the toronto-pm
mailing list