CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Error using require

 



Rivotti
User

Mar 27, 2000, 7:14 PM

Post #1 of 4 (926 views)
Error using require Can't Post

I use <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

require "file.pl";</pre><HR></BLOCKQUOTE> and it returns :

Can't locate .pl in @INC (@INC contains: /usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at /home/cgi-bin/curriculum/passo5.cgi line 8.

Can someone help me?


japhy
Enthusiast

Mar 27, 2000, 7:24 PM

Post #2 of 4 (926 views)
Re: Error using require [In reply to] Can't Post

Apparently, you're not telling Perl to read the file "file.pl". Perhaps you're doing something like:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


require "$this.pl"; # and $this is actually empty
</pre><HR></BLOCKQUOTE>

Check your code for simple typos.

And whatever file it is you're requiring, please be sure the last line of the file is:

1;


darian
Deleted

Mar 28, 2000, 3:53 AM

Post #3 of 4 (926 views)
Re: Error using require [In reply to] Can't Post

using require looks in @INC which is defined on the server side. to require a file that is not in one of these directories you need to put this before your require:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use '/path/to/the/directory';</pre><HR></BLOCKQUOTE>

Just make sure you have the full path there. If you have the access then you could put your file in that directory and not use the 'use' statement. Also note that when doing this, any other require statement below this will also use that path. So if you have multiple require statements (ex. using several modules and also a file you created) then put your module require statements in and then do your 'use' statement for the file you created.


Stanley



Rivotti
User

Mar 28, 2000, 4:54 AM

Post #4 of 4 (926 views)
Re: Error using require [In reply to] Can't Post

Thank you both. I found what I was doing wrong. The file I was trying to require had code like "$var= new CGI->param("var");". It seems that I can't require that kind of data.

Rivotti

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives