in reply to Getting perl file path from Function

I am trying to get the script path not from the loaded modules but from a function name. the only thing i have is the module is called &test(). Can i take that and get the file path?

The problem is this is a legacy system I am trying to add something to. So switching to modules is probably not going to happen.

But if i wanted to take on the task in the leggacy code it has die { require'/....'; }; can you do that with loaded modules? and catch the error with $@?
  • Comment on Re: Getting perl file path from Function

Replies are listed 'Best First'.
Re^2: Getting perl file path from Function
by Corion (Patriarch) on Oct 04, 2010 at 13:42 UTC

    See require for information on require and caller for information on how/where a function was called.

      The only issues is I am not calling the sub. So can i use caller to get the information i need? See an example below:
      my ($package, $filename, $line) = caller(\&MODULES_ORG_PERSONAL_SETTIN +GS_userManager_emergencyContacts);

        What part of the caller documentation makes you think that this would work?