I've been working on a Perl module, package CARS::Web, which provides
various important functionality for web development for my group.  It
inherits from the CGI module in order to absorb its functionality.  (All
functions I added have a standard prefix and my new object data sits in its
own sub-hash, so I don't think there are conflicts.)  However, when testing
it aggressively under mod_perl, I sometimes get failure with the following
error message:

        Undefined subroutine CARS::Web::select

There is indeed no such subroutine; for a CARS::Web object $w, a user calls
$w->select({-name=>'something'}, 'HTML option tags') to generate a <SELECT
...> ... </SELECT> block.  I do "use CGI '-any'" in the script, so the idea
is that after failing to find a 'select' method in CARS::Web or its
superclass (CGI) Perl looks at AUTOLOAD methods.  CARS::Web doesn't have
one, so it goes to CGI.pm's AUTOLOAD method.  Normally this method would
look at the requested method ('select'), say "I don't know any methods like
that", and die with the error message above.  (Detour: The CGI module uses
this technique as an optimization: it compiles methods as they are requested
in order to reduce startup time.)  But since I've used CGI's '-any' pragma,
it is supposed to say "I haven't seen this, but I'll pretend I have and let
it work like any other method."  Normally, this happens fine: it properly
synthesizes a method CARS::Web::select which spits out the proper HTML code.
But sometimes, especially during heavy load (simulated by scripts), it
doesn't work right.  My browser receives the following (this is according to
netscape or IE view source; the headers *are* sent to the browser):

HTTP/1.1 200 OK
Date: Wed, 23 Aug 2000 18:14:13 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.24
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>200 OK</TITLE>
</HEAD><BODY>
<H1>OK</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
Please contact the server administrator,
 [EMAIL PROTECTED] and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<P>
More information about this error may be available
in the server error log.<P>
</BODY></HTML>


And the error message "Undefined subroutine CARS::Web::select" is logged in
the error_log.  This message is generated inside of CGI.pm's AUTOLOAD
subroutine (It doesn't print a line number but I've looked at the code and
that's the only place such a message is formatted).

The headers are present regardless of the setting of PerlSendHeaders On or
Off.

I can't figure out why this is happening: I am using only scripts and
libraries that I wrote in compliance with all the mod_perl documentation.
Furthermore, this error only shows up sometimes: I am not sure whether it
simply sticks around in an httpd child (this would be *very* bad) or if it's
just intermittent anywhere.  Has anyone had a similar error message using
CGI '-any' or when inheriting from CGI?  Any mod_perl or CGI.pm wizards care
to propose a hypothesis for why this happens?  I need my library to be as
reliable as possible (it will be used heavily) so any suggestions are highly
appreciated.

Thanks,
Shimon Rura

Reply via email to