in reply to Authentication Script Path Problems

Here are the error messages for the different pages

mydomain.com/cgi-bin/WebApp/Simple.pl
Can't locate MyLib/Simple.pm in @INC (@INC contains: /home/username/public_html/cgi-bin/WebApp/libs /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at simple.pl line 5.
mydomain.com/cgi-bin/WebApp/
attempt to invoke directory as script: /home/username/public_html/cgi-bin/WebApp/

Then I copied /libs/MyLib/ to /MyLib/ and moved mydomain.com/cgi-bin/WebApp/ to mydomain.com/WebApp/

mydomain.com/WebApp/Simple.pl gives me a blank page and this error.
File does not exist: /home/username/public_html/index2_files, referer: http://www.mydomain.com/
Thanks for the info on "shift" I had looked through several tutorials and assumed the "stripping of the first part of an array" would be the root directory of the URL (www.mydomain.com/ from www.mydomain.com/blah/blah/)
  • Comment on Re: Authentication Script Path Problems

Replies are listed 'Best First'.
Re^2: Authentication Script Path Problems
by Corion (Patriarch) on Sep 12, 2010 at 08:28 UTC

    I think you will need to learn a lot about both, webservers and Perl, and also about how to install modules and how to load them.

    You haven't shown any code, so it's hard to suggest changes to your existing code.

    As a first tip, do not put any Perl modules below the website document root. Make a parallel directory, say /home/username/lib, and put your modules there. Then modify your CGI scripts to look (roughly) like this:

    #!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); use CGI; use lib '/home/username/lib'; use MyLib::Simple; my $q = CGI->new(); print $q->header; print "Hello";

        As you need to have edited the code from the page you linked to, I'll assume that you made some typo there. But you still don't tell me which exact part of the code you used, and what exact changes you made.

        If you are modifying a script, that makes you a programmer. To become a successful programmer, you will have to learn the main technique associated with it, that is, attention to detail. If you want to successfully communicate about faults in your programs that you can't find, you will have to show others your program as it is, because if you don't know where the fault in your program is, how do you expect others to divine the fault by your (neccessarily) vague retelling alone?

Re^2: Authentication Script Path Problems
by Anonymous Monk on Sep 12, 2010 at 08:48 UTC
    The Carp error messages are as follows:
    "use" not allowed in expression at simple.pl line 7, at end of line syntax error at simple.pl line 7, near "use MyLib::Simple" Execution of simple.pl aborted due to compilation errors.
    Line 7 is use MyLib::Simple; I commented that out and I get this message.
    syntax error at simple.pl line 9, near "my " Execution of simple.pl aborted due to compilation errors.
    Line 9 is my $webapp = MyLib::Simple->new(

      My code works for me. How do you think I'll be able to tell you anything about your code that you don't show?

      The Perl error message you get tells me that you have a typo somewhere before line 7.

      I think now is the time to take a step back and start with a very simple example, like the one I posted. First get that very simple example to work before you try on your main script again.

        The script is working. Thank you for your help.

        The problem was with the modules path. My host, which auto-installs all modules from cpan, separates them by 'requested modules' and the 'pre-installed modules'.