Gopakumar Ambat <[EMAIL PROTECTED]> writes: >Hello, >I have a PERL script being launched from my C++ code; the .pl file exists in > >C:\myperl\script, the .pm it "use"s is in C:\myperl\perl\modules. To resolve >the .pm path, I have >use lib"../perl/modules" #resolves path to C:\myperl\perl\modules
The FindBin module is handy for 'use lib' lines that allows you to get full path and avoid problems if script does chdir() and so makes ../ wrong. > >This works fine, but I was interested in knowing if there is some way where >I could specify the path which calling perl_parse itself? perl_parse takes >the current environ settings as the last parameter, can I add a new info >here which the PERL interpreter (and through it the .pl and .pm files) would >internally use to resolve all file path dependencies? You can add PERL5LIB=C:/myperl/perl/modules (see perldoc perlrun) (probably with either / or \ to char **env you pass in. Doesn't work in taint mode though... > >I tried unshift(@INC,"../perl/modules"), but it doesn't seem to work :( BEGIN { unshift(@INC,"../perl/modules") } probably would - @INC change has to happen at compile time for it to affect other use-s. use lib does that BEGIN stuff for you and also checks for architecture specific directories (less likely on Win32 than UNIX). > >Thanks in advance! >Gopa