|
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
|
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
