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

use TeamSite::CGI_lite; use ecm::utils; use ecm::css_utils; use ecm::IValidOEncode;

If Perl modules are used as above in Perl code, where and how do I find path for these modules ?

I checked environment variables, but did not see anything there. I am posting list of environment variables here.

C:\Program Files\Java\jdk1.6.0_25\bin>set ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\jjs\AppData\Roaming CLASSPATH=.;D:\iw-home\iw-perl\iwperl.exe;C:\PROGRA~1\IBM\SQLLIB\java\ +db2java.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQ +LLIB\java\sqlj.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar; +C:\PROGRA~1\IBM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\java\common.jar;D:\ +cssdk;C:\Users\jjs\Desktop\JavaTest; CLIENTNAME=T12789 CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=rsoesn ComSpec=C:\Windows\system32\cmd.exe DATA_DRIVE=D:/schedule DB2INSTANCE=DB2 DISPLAY=:0.0 FP_NO_HOST_CHECK=NO HOME=C:\Users\jjs HOMEDRIVE=C: HOMEPATH=\Users\jjs INCLUDE=C:\PROGRA~1\IBM\SQLLIB\INCLUDE;C:\PROGRA~1\IBM\SQLLIB\LIB IWHOME=D:\iw-home\teamsite IWOD60HOME=D:\iw-home\OpenDeployNG JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_25 LIB=;C:\PROGRA~1\IBM\SQLLIB\LIB LOCALAPPDATA=C:\Users\jjs\AppData\Local MAN_CHM_INDEX=D:/PROGRA~1/MKSTOO~1/etc/chm/tkutil.idx;D:/PROGRA~1/MKST +OO~1/etc/chm/tkapi.idx;D:/PROGRA~1/MKSTOO~1/etc/chm/tcltk.idx;D:/PROG +RA~1/MKSTOO~1/etc/chm/tkcurses.idx MAN_HTM_PATHS=D:/PROGRA~1/MKSTOO~1/etc/htm/perl;D:/PROGRA~1/MKSTOO~1/e +tc/htm/perl/pod;D:/PROGRA~1/MKSTOO~1/etc/htm/perl/ext;D:/PROGRA~1/MKS +TOO~1/etc/htm/perl/lib MAN_TXT_INDEX=D:/PROGRA~1/MKSTOO~1/etc/tkutil.idx;D:/PROGRA~1/MKSTOO~1 +/etc/tkapi.idx;D:/PROGRA~1/MKSTOO~1/etc/tcltk.idx;D:/PROGRA~1/MKSTOO~ +1/etc/tkcurses.idx NUMBER_OF_PROCESSORS=4 NUTCROOT=D:\PROGRA~1\MKSTOO~1 OS=Windows_NT Path=c:\program files (x86)\common files\interwoven\lib;D:\PROGRA~1\MK +STOO~1\bin64;D:\PROGRA~1\MKSTOO~1\bin;D:\PROGRA~1\MKSTOO~1\bin\X11;D: +\PROGRA~1\MKSTOO~1\mksnt;C:\Program Files\Support Tools\;C:\Windows\s +ystem32;C:\Windows;C:\Windows\system32\wbem;C:\Windows\system32\windo +wspowershell\v1.0\;c:\program files (x86)\common files\interwoven\lib +;c:\oracle32\ora112\bin;d:\iw-home\TeamSite\bin;d:\iw-home\TeamSite\i +w-perl\bin;d:\iw-home\teamsite\lib;d:\iw-home\teamsite\bin;d:\iw-home +\opendeployng\bin;;c:\program files\ibm\gsk8\lib64;C:\PROGRA~1\IBM\SQ +LLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPL +ES\REPL;D:\ctmag\Default\EXE\;C:\Program Files\System Center Operatio +ns Manager 2007\;C:\Program Files\Microsoft Windows Performance Toolk +it\;C:\Program Files\Microsoft Network Monitor 3\;D:\cssdk;C:\Users\j +js\Desktop\JavaTest;C:\Program Files\Java\jdk1.6.0_25\bin; PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.sh;.ksh +;.csh;.sed;.awk;.pl PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 37 Stepping 1, GenuineInte +l PROCESSOR_LEVEL=6 PROCESSOR_REVISION=2501 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public ROOTDIR=D:/PROGRA~1/MKSTOO~1 SESSIONNAME=RDP-Tcp#0 SHELL=D:/PROGRA~1/MKSTOO~1/mksnt/sh.exe SystemDrive=C: SystemRoot=C:\WindowsSYS_LEVEL=DEV TEMP=C:\Users\jjs\AppData\Local\Temp\2 TERMCAP=D:\PROGRA~1\MKSTOO~1\etc\termcap TERMINFO=D:\PROGRA~1\MKSTOO~1\usr\lib\terminfo TMP=C:\Users\jjs\AppData\Local\Temp\2 TMPDIR=C:/Users/jjs/AppData/Local/Temp/2 VER_OS=X64 windir=C:\Windows

Replies are listed 'Best First'.
Re: How to find path of Perl modules used in a code
by choroba (Cardinal) on Feb 08, 2014 at 20:21 UTC
    Try inspecting @INC from within Perl. See @INC and %INC in perlvar.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: How to find path of Perl modules used in a code
by ww (Archbishop) on Feb 08, 2014 at 21:00 UTC
    Is "TeamSite" in your D:\iw-home\ dir as your path (d:\iw-home\TeamSite\iw-perl\bin suggests? If so, somewhere there you'll probably find the (possibly modified?) copy of Teamsite::CGI-Lite.pm that you're using.

    I don't see any reference to ecm in your path (or the other items you dumped), which makes me guess that choroba's suggestion above will show you where to find the other three modules you listed.

    If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.

    Quis custodiet ipsos custodes. Juvenal, Satires

Re: How to find path of Perl modules used in a code
by shmem (Chancellor) on Feb 09, 2014 at 08:59 UTC
    If Perl modules are used as above in Perl code, where and how do I find path for these modules ?

    The perl search path is (mostly) not in the environment, it is built into perl. The only search path alternative in the environment is the variable PERL5LIB, whose content will be prepended to the search path list, which is in the perl special variable @INC.

    If my PERL5LIB contains /home/shmem/perl/lib then:

    qwurx [shmem] ~ > perl -le 'print $INC[0]' /home/shmem/comp/perl/lib

    To get the path of a loaded module, convert all double colons to slashes and append ".pm" (e.g. TeamSite::CGI_lite becomes TeamSite/CGI_lite.pm), and lookup that key in the hash %INC.

    Examples (see perlrun for the command line switch -M):

    qwurx [shmem] ~ > perl -MIO::Select -le 'print $INC{q(IO/Select.pm)}' /usr/lib/perl/5.14/IO/Select.pm qwurx [shmem] ~ > perl -My -le 'my $m = q(y.pm);print $INC{$m}' /home/shmem/comp/perl/lib/y.pm

    Note that the above examples are for Linux/UNIX/cygwin. Use double quotes in cmd.exe on Windows.

    update: added @INC code example, y.pm example

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re: How to find path of Perl modules used in a code
by adefaria (Beadle) on Feb 09, 2014 at 14:37 UTC
    Use the perl debugger. Do perl -d <script>. Once in the debugger switch to the module:
    Defaria:perl -de 0 Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1> use CGI; DB<2> f CGI Choosing /usr/share/perl/5.14/CGI/Util.pm matching `CGI': 1 package CGI::Util; 2 3: use strict; 4: use vars qw($VERSION @EXPORT_OK @ISA @A2E @E2A); 5: require Exporter; 6: @ISA = qw(Exporter); 7: @EXPORT_OK = qw(rearrange rearrange_header make_attributes unesc +ape escape 8 expires ebcdic2ascii ascii2ebcdic); 9 10: $VERSION = '3.51'; DB<3>
    You'll notice the line starting with "Choosing". That tells you the path to the module that perl actually loaded.