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

Hi, I got the problem. I have two programs and want them to use one common module written by mine. I launch one program that launches another one (system(...)). I use Win2K. Both programs use the same module. The first program is Ok. But when it launches another program - another program can't use the same module: "Cant locate ... module in @INC" When I launch another program separately - everything is ok. Is it Ok for Perl? Thanks.

Replies are listed 'Best First'.
Re: 2 programs cant use the same module :O
by gregorovius (Friar) on Sep 22, 2000 at 09:45 UTC
    Where is your .pm file located?

    Try copying it to your site/lib directory, which usually is C:\Perl\site\lib on ActiveState.

    It is strange that this happens, since both the parent and child should share the same working directory. Is it that you have the second script on a different directory, and you chdir to it before launching it? If this is the case then don't chdir and do

    system('perl dir/other.pl');
    and it should work.
Re: 2 programs cant use the same module :O
by Fastolfe (Vicar) on Nov 11, 2000 at 23:44 UTC
    You may also be interested in 'use lib', which would specify alternative directories to look for modules. If for whatever reason the directory that has this module is in the parent's @INC but not the child's, this pragma would allow you to fix that.