While debugging this error, I have found that  if I preload all modules
after "use strict" and carp in a startup file, I see additional errors when
the modules compile.  Sure I did see the errors, but why must I preload each
module in such a manner when it's not necessary except to check for errors?
Is mod_perl supposed to direct ALL errors to the error log?  Should all perl
modules be loaded in a startup file or with the PerlModule directive?

Regards,
Craig Bullock


-----Original Message-----
From: Craig Bullock <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, December 10, 1999 10:21 PM
Subject: Intermittent Insecure dependency error


mod_perl group,

I have an issue with mod_perl I'm trying to resolve for several days.  I
have a module called Apache::StartPage and is mapped with a Location
directive. Occasionally I have the following error showing up in the error
log from routines in Carp module mapped to $SIG{__WARN__} and $SIG{__DIE__}
interrupts in httpd -X mode:

[Fri Dec 10 17:51:44 1999] [error] Insecure dependency in require while
running with -T switch at (eval 38) line 3.
        eval 'require Apache::StartPage
;' called at (eval 38) line 0

[Fri Dec 10 17:51:44 1999] [error] Undefined subroutine
&Apache::StartPage::handler called.
        eval {...} called at /dev/null line 0

I have two different mod_perl projects on different architectures (Linux,
HP), and I'm seeing this error type in both.  Each project uses only Apache
API (no CGI or Registry) is involved. I like using the strict module, but
it's driving me nuts.  Do I have serious problems with the following module
because modperl occasionally rejects it? Is there a mechanism I can put in
place to further trace this error;


package Apache::StartPage;
# File: Apache/StartPage.pm

use strict;
use Apache::Constants qw(:common);
use DBI;

sub handler {
  my $r = shift;

  my $filename = $r->dir_config('ContentPath') . "start.html";
  my $fh = Apache::gensym();
  open($fh, $filename) || return NOT_FOUND;

  my $projectoptions  = undef;
  my $id = undef;
  my $option = undef;
  my $dbh = DBI->connect("DBI:mysql:database","username","password");
  my $sth = $dbh->prepare("SELECT projectid,project FROM projects ORDER by
project ASC");
  $sth->execute;
  while (($id,$option) = $sth->fetchrow) {
    $projectoptions .= "<option value=$id>$option";
  }
  $sth->finish;
  $dbh->disconnect;

  $r->send_http_header("text/html");

  read $fh, my $data, -s $filename;
  close($fh);

  $data =~ s/<!--projectoptions-->/$projectoptions/;

  my $dataref = \$data;
  $r->print($$dataref);

  return OK;

}

    1;

Reply via email to