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

hello,
I'm facing a problem.
I have perl file named Login.pl.
Im using a perl PM file called "IDVDb.pm".
Its location is abc/pm/IDVDb.pm.
I have included a statement called use abc::pm::IDVDb.pm in Login.pl. When i try to compile, it is giving error as below.
IDVDb.pm: Can't locate abc/pm/IDVDb.pm in @INC (@INC contains: /opt/pe +rl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5 .00503 /opt/perl5/lib/site_perl/PA-RISC2.0 /opt/perl5/lib/site_perl .) + at Login.pl line 10. BEGIN failed--compilation aborted at Login.pl line 10.


what is the problem?
How to configure @INC to specified path?
could any one pls help me in this regard.Its urgent.
Thank you in advance.

Replies are listed 'Best First'.
Re: configuring @INC
by matija (Priest) on May 06, 2004 at 11:34 UTC
    You're changing the name of the module so that it would be found in the path, that's your problem. You should do a
    use lib "abc/pm/"; use IDVDb;
    The "use" command should always call the module the same as the module's package statement names it.
      hi
      I tried by giving
      use lib "abc/pm/"; use IDVDb;

      eventhough , it is giving the same error.
      Actual path of "abc/pm/IDVDb.pm" is "/example/abc/pm/IDVDb.pm".
      is there any way to configure @INC variable.
        Well, DUH! use the actual path, then! I used the path you gave in your question and I figured you'd be smart enough to adapt it to the right value yourself.

        Just to make this absolutely clear, if your module is located in /opt/mrn/Foo/Bar/Baz.pm
        and the package line says:
        package Bar::Baz:, then you need to say>
        use lib "/opt/mrn/Foo";

Re: configuring @INC
by dave_the_m (Monsignor) on May 06, 2004 at 11:35 UTC
    You probably want something like
    use lib 'abc/pm'; use IDVDb;
    although you don't say where the directory abc is relative to.
      hi
      I tried by giving
      use lib "abc/pm/"; use IDVDb;

      eventhough , it is giving the same error.
      Actual path of "abc/pm/IDVDb.pm" is "/example/abc/pm/IDVDb.pm".
      is there any way to configure @INC variable.
Re: configuring @INC
by inman (Curate) on May 06, 2004 at 11:46 UTC
    Look at the perlrun POD which describes the use of the -i argument to add a path to the @INC array. This documentation also includes the environment information that is used by the executable. Setting the PERL5LIB environment variable to include the path of your modules.