[ back to toc ]

CGI Trouble Shooting

Date: 2001/12/14 21:02

Q:
Hey Peter, Could you point me in the right direction to get this error
resolved? I am currently learning CGI/Pearl and looking into the Open
Source offerings of extropia.com. The applications and documentation are
available at http://www.extropia.com/applications.html.
I am hosted on WIN2000 running Pearl 5.60. I usually can play arround with
code to get things to work but am at a small impass.

#URL
http://danceshots.com/cgi-bin/address_book.cgi

#Output
Can't locate Extropia/Core/App/DBApp.pm in @INC (@INC contains: Modules
Modules/CPAN . D:/Perl/lib D:/Perl/site/lib) at
d:\html\users\danceshotscom\html\cgi-bin\address_book.cgi line 46.
BEGIN failed--compilation aborted at
d:\html\users\danceshotscom\html\cgi-bin\address_book.cgi line 46.

.::[CODE Example Begin]::..
use strict;
BEGIN{
use vars qw(@dirs);
@dirs = qw(Modules
Modules/CPAN .);
}
use lib @dirs;
unshift @INC, @dirs unless $INC[0] eq $dirs[0];

my $APP_NAME = "address_book";

my $GLOBAL_DATAFILES_DIRECTORY =
"d:/html/users/danceshotscom/database/Datafiles";
my $TEMPLATES_CACHE_DIRECTORY =
"$GLOBAL_DATAFILES_DIRECTORY/TemplatesCache";
my $APP_DATAFILES_DIRECTORY = "Datafiles/AddressBook";

my @VIEWS_SEARCH_PATH =
qw(Modules/Extropia/View/AddressBook
Modules/Extropia/View/Default);

my @TEMPLATES_SEARCH_PATH =
qw(HTMLTemplates/AddressBook
HTMLTemplates/Default);

use CGI qw(-debug);
#use CGI::Carp qw(fatalsToBrowser);

use Extropia::Core::App::DBApp;#..::[Error Line]::..#
use Extropia::Core::View;
use Extropia::Core::Action;
use Extropia::Core::SessionManager;
.::[CODE Example End]::..

When I received a similar error from a script written by someone else I
thought this may be related not to the scripts temselves but to the pearl
installation or the setting of my web host.

#URL
http://danceshots.com/cgi-bin/cc_whois.cgi

#Output
Can't locate cgi-lib.pl in @INC (@INC contains: D:/Perl/lib
D:/Perl/site/lib .) at
d:\html\users\danceshotscom\html\cgi-bin\cc_whois.cgi line 80.

.::[CODE Example Begin]::..
#########
## 1. DECLARE THE URL TO YOUR COPY OF CC_WHOIS.CGI.
#########
$me = "http://danceshots.com/cgi-bin/cc_whois.cgi";

#########
## 2. INDICATE THE PATH TO YOUR SERVER'S WHOIS PROGRAM.
## YOU CAN DETERMINE THIS BY TYPING "which whois" AT THE TELNET PROMPT.
#########
$which_whois = "/usr/local/bin/whois" ;

#########
## 3. ASSIGN A NAME OR TITLE FOR YOUR WHOIS PAGE.
#########
$pagetitle = " DanceShots Domain Name Whois ";

#########
## 4. ASSIGN THE NECESSARY SPECIFICATIONS FOR THE <BODY> TAG OF THE
## CGI-GENERATED PAGES. ALL QUOTATION MARKS MUST BE PRECEDED BY A
## BACKSLASH LIKE THIS: \"
#########
$bodyspecs = " BGCOLOR=\"#336699\" TEXT=\"#FFFFFF\" LINK=\"#FFFFCC\"
VLINK=\"#00FF00\" ALINK=\"#FF0000\" ";

##########
## 5. IF YOU ARE USING A BACKGROUND IMAGE FOR YOUR "GOODBYE" PAGE,
## PLACE THE FULL URL HERE.
##########
$bgdimage = "http://danceshots.com/image.gif";

##########
## 6. ASSIGN THE DOMAINS AND IPs YOU WISH TO ALLOW PERMISSION TO RUN THE
## CC WHOIS PROGRAM. ANY DOMAIN/IP NOT LISTED IN THE ARRAY WILL GET AN
ERROR.
## ENCLOSE EACH DOMAIN/IP IN AN OPEN AND CLOSE QUOTE; SEPARATE EACH
WITH A COMMA.
##########
@referers=("icthus.net/CGI-City", "icthus.net", "danceshots.com");

###########################################
## DO NOT EDIT ANYTHING BEYOND THIS LINE ##
###########################################
require ('cgi-lib.pl'); #..::[Error Line]::..#
&check_referer;
&ReadParse(*form_data);
$domain = lc($form_data{'domain'});
$domain =~
s/[\|\\\/\!\@\#\$\%\^\&\*\(\)\[\]\{\}\;\:\'\"\+\=\_\?\.\,]//isg;
$ext = $form_data{'ext'};
$ABC = $form_data{'ABC'};
if ($ABC eq "123") { &WhichNIC; }
$DOMAIN = "$domain"."$ext";
$result = '$whois $DOMAIN';
$errmsg = "";
$message = "";
if ($ENV{'QUERY_STRING'} =~ /LOOKUP/i)

&Stripper;
&CheckError;
&PrintResults;
}
&PrintPage;
.::[CODE Example End]::..

Let me know if you need additional information and thanks in advance for
your assistance.

*NAME-DELETED* *NAME-DELETED*

A:
>When I received a similar error from a script
>written by someone else I thought this may be
>related not to the scripts temselves but to
>the pearl installation or the setting of my web host.

YES! You are correct. The error code you wrote means that a module that
the Perl (btw: sorry to correct, but better me than a bunch of selfish
geek nerd laughing at you: this is called Perl and not pearl or Pearl). So
back to the main issue. The error code means that Perl can not find a
module. Maybe the module is not installed on the machine or is intalled
erroneously. To load a module the Perl code need a file names XXX.pm,
where XXX is the name written after the command "use". In ther example
above it is

Extropia::Core::App::DBApp

Perl tries to locate this file Extropia/Core/App/DBApp.pm in the
directories that are listed in the global Perl variable @INC (this is an
array). But it can not find.

You have to download the module and install it. To do that you need the
.pm file and in case the module contains some binary then you also need
the .ddl file. Sometimes they have the extension .pll, but do not be
afraid, they are just normal DLL files. However it may happen that a
module is not compiled for Windows. In that case you forget it or start a
year long study how to compile a Perl module and also port from UNIX to
NT. (I never dared it. Once I wrote a simple module in C for Perl, but
never ported any module from UNIX to NT.)

Summa summarum: this is difficult.

I hope I helped a bit to clean up the issue.

Regards,
Peter

[ back to toc ]