http://www.perlmonks.org?node_id=994125


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