mlong has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to, at runtime, determine the path of the module currently in use? I've completely removed a .pm file from my working directory yet the script that uses it is still managing to find it. In other words, 'use modulename;' is working even though the file doesn't exist. This is being called from a CGI. Any ideas? Thanks. -Matt

Replies are listed 'Best First'.
Re: Obtain Location of .pm in Use
by FunkyMonk (Bishop) on Aug 29, 2007 at 22:11 UTC
    %INC maintains a hash of (module filename relative to directories in @INC) => (full path to module file). ie, on my system, I get
    $VAR1 = { 'warnings/register.pm' => '/usr/share/perl/5.8/warnings/regi +ster.pm', ...

    from use Data::Dumper; print Dumper \%INC

    That should tell you where perl is finding your module.

      Thanks for your help. That was exactly what I needed. -Matt
Re: Obtain Location of .pm in Use
by kyle (Abbot) on Aug 30, 2007 at 01:42 UTC