in reply to Getting perl file path from Function

Please use modules, its just easier (see Simple Module Tutorial)
$ echo sub crap { ' crap '; } 1; >crap.pl $ perl -MDevel::Peek -e" require 'crap.pl' ; Dump(\&crap )" SV = RV(0x3e8cb8) at 0x3e8cac REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x3e8cbc SV = PVCV(0x9b50b4) at 0x3e8cbc REFCNT = 2 FLAGS = () COMP_STASH = 0x3e8acc "main" START = 0x9b25f4 ===> 0 ROOT = 0x9b25b8 GVGV::GV = 0x98a484 "main" :: "crap" FILE = "crap.pl" DEPTH = 0 FLAGS = 0x0 OUTSIDE_SEQ = 96 PADLIST = 0x98a4b4 PADNAME = 0x3e8c8c(0x9961c4) PAD = 0x98a4f4(0x9abc2c) OUTSIDE = 0x3e8abc (UNIQUE) $

Replies are listed 'Best First'.
Re^2: Getting perl file path from Function
by clintonm9 (Sexton) on Oct 04, 2010 at 18:03 UTC
    I just saw this post. I tried this and it returned the wrong file path. It wasnt the script that the function was in.
    SV = RV(0x1ee3f430) at 0x1ee8f8c0 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x1ee8fbc0 SV = PVCV(0x1ee66a10) at 0x1ee8fbc0 REFCNT = 2 FLAGS = () IV = 0 NV = 0 COMP_STASH = 0x1a6ad180 "main" ROOT = 0x0 XSUB = 0x0 XSUBANY = 0 GVGV::GV = 0x1edf27a0 "main" :: "MODULES_ORG_PERSONAL_SETTIN +GS_userManager_emergencyContacts" FILE = "/home/website/API/APIScripts/Admin.pl" DEPTH = 0 FLAGS = 0x0 OUTSIDE_SEQ = 40228 PADLIST = 0x1ee8fb90 PADNAME = 0x1ee7c6a0(0x0) PAD = 0x1ee7c6b0(0x1f042fc0) OUTSIDE = 0x0 (null)
    This function is not in Admin.pl
      You are correct. This does work! I was using the wrong Namespace. Now the only issues is it prints using warn or something. Can i retrun the data with Dump?