perl can't find perl modules (*.pm)?
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: perl can't find perl modules (*.pm)?

  1. #1
    Senior Member
    Join Date
    Apr 2002
    Posts
    214

    Unhappy perl can't find perl modules (*.pm)?

    For some reason, on my new linux box, I have apache and perl installed. In a cgi script, if I refer to a module in another directory (as shown below), it won't work. I know my permissions are set correctly and everything. Any suggestions?

    #!/usr/bin/perl
    require './folder/module.pm';

    btw, its a linux box, and the same scripts worked fine on a Windows box.

    -Mike
    Either get busy living or get busy dying.

    -The Sawshank Redemption

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    OK, rather than saying, "it won't work", why don't you tell us what you've tried and the error messages that you've been getting in each case. I know of a few reasons that this might happen but you haven't provided any information for people to go on. Otherwise don't expect much help *sigh*.
    OpenBSD - The proactively secure operating system.

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    214
    well, I was trying to install a bulletin board from ikonboard.com, and followed the exact instructions that came with the scripts and stuff. (Like I said, the same message board worked on a windows box). I get the following error message:

    Software error:
    Can't locate functions.pm in @INC (@INC contains: /home/httpd/cgi-bin/ikboard/ /home/httpd/cgi-bin/ikboard/Sources/ /home/httpd/cgi-bin/ikboard/install_modules/ /usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .) at /home/httpd/cgi-bin/ikboard/installer.cgi line 109.

    It's a linux box, trustix distribution (trustix.net), apache, perl 5
    Either get busy living or get busy dying.

    -The Sawshank Redemption

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    OK, when you run PERL you need to tell it where the .pm module is that you're trying to use. Currently it's not in the any of the directories that PERL is looking for modules in.

    perl - I <dirictory_name>

    Should fix the problem. For more information: man perl.

    An alternative solution is at the very start of your program do:

    #!/usrl/local/perl
    push(@INC, '/the/path/of/your/module/goes/here');

    That will add the path to @INC so PERL knows where to find the module.
    OpenBSD - The proactively secure operating system.

  5. #5
    Senior Member
    Join Date
    Apr 2002
    Posts
    712
    You also probably need to drop the *.pm as it's implicit on the "use" commands.

    You can also "push( @INC, /list/directory/here )" to help it along.
    \"Windows has detected that a gnat has farted in the general vicinity. You must reboot for changes to take affect. Reboot now?\"

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    214
    You also probably need to drop the *.pm as it's implicit on the "use" commands
    can you rephrase that a little, i don't exactly know what you mean...

    smirc, can i still use that if I am refering to more than one perl module (in different directories)? sorry to be so annoying....
    Either get busy living or get busy dying.

    -The Sawshank Redemption

  7. #7
    Senior Member
    Join Date
    Apr 2002
    Posts
    214
    it still won't work. i think it's a bug in somethin. I'm probably going to change from trustix linux to red hat. the script gives a slightly different error now:

    Can't locate functions.pm in @INC (@INC contains: /home/httpd/cgi-bin/ikboard/ /home/httpd/cgi-bin/ikboard/Sources/ /home/httpd/cgi-bin/ikboard/install_modules/ /usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 . /home/httpd/cgi-bin/ikboard/install_modules/) at /home/httpd/cgi-bin/ikboard/installer.cgi line 111.

    from what I make of the error, it says it looked in the directory of the module (/home/httpd/cgi-bin/ikboard/install_modules/). oh well.
    Either get busy living or get busy dying.

    -The Sawshank Redemption

  8. #8
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    smirc, can i still use that if I am refering to more than one perl module (in different directories)? sorry to be so annoying
    Yes just do two separate push statements for each directory.

    Can't locate functions.pm in @INC (@INC contains: /home/httpd/cgi-bin/ikboard/ /home/httpd/cgi-bin/ikboard/Sources/ /home/httpd/cgi-bin/ikboard/install_modules/ /usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 . /home/httpd/cgi-bin/ikboard/install_modules/) at /home/httpd/cgi-bin/ikboard/installer.cgi line 111.
    Looks like it can't find the module file. Have you checked that it actually exists?

    it still won't work. i think it's a bug in somethin. I'm probably going to change from trustix linux to red hat. the script gives a slightly different error now:
    This error has nothing to do with the distro that you are using. You'll just get the same error message on Redhat. That is, unless the software is specifically meant for Redhat and that's why the original install failed (which I doubt).
    OpenBSD - The proactively secure operating system.

  9. #9
    Senior Member
    Join Date
    Apr 2002
    Posts
    214
    yea, I'm postitive the module exists. i'm lookin at it now. I've attached the perl script that I'm trying to get to work to this post. Maybe you can find something wrong with the paths or something....this is driving me insane!

    btw, the original extention of this script was .cgi
    Either get busy living or get busy dying.

    -The Sawshank Redemption

  10. #10
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    Code:
    ####################################################
    # Load the Installer functions library
    
    require 'functions.pm' or iB::install_error ( 'Could not load install_modules/functions.pm' );
    my $functions = functions->new();
    
    #
    Looks like this is the line causing the error but you've probably figured that out. You'll have to make sure that the $ENV{'PATH'} variable includes the directory where the functions.pm module is located. So you can either edit $ENV{'PATH'} or include the full path to the file in the above code. That should fix the problem.
    OpenBSD - The proactively secure operating system.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •