Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: BEGIN block and failure to initialize constants

by GrandFather (Sage)
on Sep 17, 2012 at 22:03 UTC ( #994125=note: print w/replies, xml ) Need Help??


in reply to BEGIN block and failure to initialize constants

I get the path of a loaded module using:

sub GetVariousPath { # Hacky way to figure out relative location of TaskManager::Variou +s.pm from # running script's context my @variousPaths = map {$INC{$_}} grep {m!TaskManager[\\/]Various\.pm$!} keys %INC; push @variousPaths, __FILE__; s!(.*)[\\/].*!$1! for @variousPaths; -d $_ && return $_ for @variousPaths; die "Unable to determine path to TaskManager::Various module\n"; }

and then use that path as teh context for getting at a configuration file.

True laziness is hard work

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2016-10-01 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (9 votes). Check out past polls.