perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Chamas <jos...@chamas.com>
Subject Re: Can't call method "dir_config" on an undefined value
Date Mon, 17 Jun 2002 00:48:23 GMT
[[ forward to the list ]]

Ross Thomas wrote:
> 
> On Sun, 16 Jun 2002 13:10:42 -0700 "Joshua Chamas" <joshua@chamas.com>
> wrote:
> 
> > Do you get a better stack trace if you set
> >
> >   $SIG{__DIE__} = \&Carp::confess;
> 

What the trace tells me is that you end up with a cached Apache::ASP 
object from one request that gets used after it expires in another request.

The common cause for this is that you have a subroutine compiled somewhere
like an XMLSubs, or other, that caches the ASP object is references 
upon compilation.  This kind of perl sub compilation object caching 
is described at:

  http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S

Typically, you can avoid this by moving all subs definitions to non ASP files
and using the UseStrict config, as well as adding "use strict;" to the 
top of your perl modules.  This will cause perl to throw a hard error
when you try to use these object outside your current namespace.

When/if you move your XMLSubs & other subs to their own perl packages,
you will find a namespace issue in which they do not have access to objects
like $Response, because $Response is only available in ASP scripts directly.
To overcome this deficit, you can always access objects in the main namespace
as in

  $main::Response->Include()

from other perl packages.  Further, if you set GlobalPackage, you can also
access object in that package like

  PerlSetVar GlobalPackage Site

  $Site::Response->Include()

--Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message