Hi Ukhas,
 
First, you need to understand some differences. For this, i'll give you some basic examples:
 
use CGI;
# This will look for CGI.pm inside of the default libraries contained in @INC. If found, it's loaded before actually executing the code.
 
use CGI::Carp;
# This will loos for CGI/Carp.pm inside of the default libraries contained in @INC. If found, it's loaded before actually executing the code.
 
require CGI;
# The same as the first example, except CGI.pm will be loaded where the "require" is requested.
 
require "script.pl";
# This won't automatically add the extension .pm but it will load script.pl at demand.
 
require "/some/path/to/script.pl";
# The same as previous, but it will look for script.pl inside the given path.
 
Now, @INC is a default reserved array that contains your current execution directory followed by the default paths to your Perl's installation libraries (p.e. ./, /usr/lib/, /usr/site/lib). If you need to specify a custom library path, you can do the following before calling your module or script:
 
use lib "/some/path";
use lib "/some/additional/path";
 
That way, @INC will have first your custom library paths followed by the default installation paths.
 
What you need, according to your message, is to put inside B.cgi the following line:
 
require "A.cgi";
# Assuming that it's in the same path as B.cgi, otherwise "require" it with the full path to A.cgi
 
IMPORTANT: To avoid any problems (since i don't know what A.cgi does), put at the very end of A.cgi the following line:
 
1;
 
This is a precaution, because any "use"d or "require"d file should return a true value.
 
Finally, you could've figured it out by making your script show you the error on screen instead of the default Error 500 page. To do that, put the following line at the beggining of your scripts:
 
use CGI::Carp qw(fatalsToBrowser);
 
AND, i highly recommend to use warnings and sctrict. It will force you to use well written codes, but will save you LOTS of wasted time trying to find the reason of problems:
 
use strict;
use warnings;
#use diagnostics;
 
The last line is commented on purpose. Uncomment it only when the errors given by sctrict or warnings are not enough for you to understand the problem. That module really slows down your scripts, so don't use it uncommented by default.
 
HTH
 
Paco Zarabozo
 
 
----- Original Message -----
Sent: Friday, October 06, 2006 3:27 AM
Subject: RE: regarding CGI

to "use"  any pm/perl file you have that in usr/lib/perl..  as its checked at the compile time itself.
 
you can use "require" pm by putting in some known path  as its checked on run time .
 
 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ukhas jean
Sent: Friday, October 06, 2006 1:49 PM
To: Active Perl
Subject: regarding CGI

1. can we "use" or "require" a .cgi file into another .cgi file??
2. I declared a variable of scope "our" in A.cgi ... and "use"d it in B.cgi ... but IE reports error. any way to get around this??
 
regards,
ukh


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to