Got a phone call yesterday from a user who was complaining that every few
times a link was clicked on they were getting an "Internal Server Error".
They could click back, try again, and be successful.  Further investigation
led me to find that one of the instances of my back end server was always
generating an error.

Restarts would not fix the problem - one or two of the app servers would
always throw errors....

The error was this:

[Mon Sep 23 19:12:21 2002] [error] Can't call method "dir_config" on an
undefined value at /webroot/lib/Husky/Web/Apache
/MasonHandler.pm line 68.

The line in question is this:

    my $appl_id = $r->dir_config( 'ApplID' );

So, you can see that '$r' was undefined.

The interesting thing is that the handler that's invoked for this request
has a prototype:

    sub handler( $$ ) { my $class = shift; my $r = shift; ... }

and the handler is either invoked by Apache directly, or from internal logic
when a request is passed off.  The handler is invoked in one of two ways:

  __PACKAGE__->a_method_name( $r );

or

    Foo::Bar::Bah->a_method_name( $r );

Now, it appears that every now and then the class reference is NOT being
sent; hence, $class actually contains $r, and $r is undefined.  This is
obviously bad, since $r->dir_config dies a horrible death.....

Has anyone had a problem with this?  Is there something that might give me a
clue as to why this is failing?  In the meantime, I've when back to
referencing the sub directly, as opposed to going through the class.  It
works, but it's not as nice as a class method...

Cheers!

    -klm.

+---------------------------------+-------------------------------------+
| Kenneth (Ken) L. Miller         | There are 10 kinds of people in the |
| Shetland Software Services Inc. | world: Those who understand binary, |
| [EMAIL PROTECTED]        | and those who don't.     (unknown)  |
+---------------------------------+-------------------------------------+

Reply via email to