Hi All,
One of the modules used in my script is present in more than one location (say path1 and path2) and I always want the one at path2 to be picked up. Also all the other modules should be picked up only from path1 even if they are present in path2.

I have specified "use lib path2" but it still always picks up the one at path1. The code is something like 'eval "use P4";' somewhere in the middle of the script (not written by me) and to debug I have added the following just before the eval statement:

if (require "P4.pm") { print "$INC{"P4.pm"}; }
This print always gives path1.

I also tried unshift ("path2", @INC) before eval, to make sure it is available right at the beginning of the array but it still ends up picking path1. Just to check I removed path1 from @INC and surprisingly the print statement still gives "path1"!

How do I go about achieving what I have specified at the top?Kindly help.

Also, moving around the modules to the right location or leaving out one of the paths is not an option :(

Thanks much,
srinigs


In reply to Picking up a module from a specific location by srinigs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.