blackcode has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all

I installed perlfect search engine and i found came across the following problem. Please note, when i issue the command via terminal I get the indexer.pl and search.pl working perfectly fine. The only problem arises when I try to access search.pl/indexer.pl via Http/localhost/cgi-bin/search.pl

The following is the error I get:

Server error! The server encountered an internal error and was unable to complete yo +ur request. Error message: Attempt to reload DB_File.pm aborted. Compilation failed in require at + /opt/lampp/cgi-bin/perlfect/search/search.pl line 47. BEGIN failed-- +compilation aborted at /opt/lampp/cgi-bin/perlfect/search/search.pl l +ine 47. , If you think this is a server error, please contact the webmaster. Error 500

I have Xampp installed on ubuntu. I have also installed DB_file.pm. The snippet of script of search.pl is

use DB_File; $db_package = 'DB_File'; package AnyDBM_File; @ISA = qw(DB_File); # You may try to comment in the next line if you don't have DB_File. S +till # this is not recommended. #@ISA = qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File); foreach my $isa (@ISA) { if( eval("require $isa") ) { $db_package = $isa; last; } } package main; require 'conf.pl'; require 'tools.pl'; init_config(); # See indexer.pl for a description of the data structures: my %inv_index_db; my %docs_db; my %urls_db; my %sizes_db; my %desc_db; my %content_db; my %titles_db; my %dates_db; my %terms_db; tie %inv_index_db, $db_package, $INV_INDEX_DB_FILE, O_RDONLY, 0755 or +die "Cannot open $INV_INDEX_DB_FILE: $!"; tie %docs_db, $db_package, $DOCS_DB_FILE, O_RDONLY, 0755 or die " +Cannot open $DOCS_DB_FILE: $!"; tie %urls_db, $db_package, $URLS_DB_FILE, O_RDONLY, 0755 or die " +Cannot open $URLS_DB_FILE: $!"; tie %sizes_db, $db_package, $SIZES_DB_FILE, O_RDONLY, 0755 or die +"Cannot open $SIZES_DB_FILE: $!"; tie %desc_db, $db_package, $DESC_DB_FILE, O_RDONLY, 0755 or die " +Cannot open $DESC_DB_FILE: $!"; tie %content_db, $db_package, $CONTENT_DB_FILE, O_RDONLY, 0755 or di +e "Cannot open $CONTENT_DB_FILE: $!"; tie %titles_db, $db_package, $TITLES_DB_FILE, O_RDONLY, 0755 or +die "Cannot open $TITLES_DB_FILE: $!"; tie %dates_db, $db_package, $DATES_DB_FILE, O_RDONLY, 0755 or die +"Cannot open $DATES_DB_FILE: $!"; tie %terms_db, $db_package, $TERMS_DB_FILE, O_RDONLY, 0755 or die +"Cannot open $TERMS_DB_FILE: $!";

Replies are listed 'Best First'.
Re: Perlfect aborted when loading DB_file.pm
by Corion (Patriarch) on Dec 26, 2009 at 20:41 UTC
    Compilation failed...

    This means that something is bad with your DB_File.pm. If you load it from the command line like this:

    perl -MDB_File -e1

    ... you should see the actual error. Maybe take a look at what DB_File.pm contains.

    Normally, there is no need to "install" DB_File, because it comes with Perl itself. How did you "install" DB_File?

      First, Thanks alot for your help!
      # perl -MDB_file -e1 Can't locate DB_file.pm in @INC (@INC contains: /etc/perl /usr/local/l +ib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share +/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_pe +rl .). BEGIN failed--compilation aborted.

      Thats the error I got. And on installation, i first installed Berkeley as DB_file required db.h to /usr/local/contrib/include and ../lib. And i configured config of DB_File.pm to point to db.h and did a make install. I actually am not too sure when i should put DB_file.pm Any suggestion greatly appreciated! :)

        Perl distinguishes between DB_file and DB_File. The module is named DB_File, so you better check again using:

        perl -MDB_File -e1

        Also, I don't really understand your description of your installation. Did install DB_File via the CPAN tool or do:

        perl Makefile.PL make make test make install

        (the two are roughly equivalent) or did you do another form of "install"?

        Note: It's "DB_File"--not "DB_file". As Corion said, DB_File is part of the core since the beginning of perl5. It's also dualLived, so it can be updated.

        I can't find anything essentially wrong with DB_File nor search.pl; however, the README in the source emphatically says to use ssh/telnet. HTTP can lead to breaches of security and "should be used only when absolutely necessary".