You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Guillaume <gu...@ideasandassociates.com> on 2001/11/05 21:19:37 UTC
Perl Handlers and namespaces.
I ran into this problem today. I am trying to develope a small
application server with a few handlers and Apache/1.3.22 .
So I have something that looks like this set up in the apache conf file:
<Location /somewhere>
<Limit GET POST HEAD>
Allow from all
</Limit>
PerlRequire "startup.pl"
SetHandler perl-script
PerlHandler AppServer
AuthName "AppServer"
AuthType Basic
PerlAuthenHandler AppServer::Auth
require valid-user
PerlAccessHandler AppServer::Access
</Location>
Now, you notice that these packages are all under the same namespace.
This, somehow, causes an 'Undefined subroutine &AppServer::handler
called.' each time the server recieves a request from a client. However,
if i move the main handler into another
namespace or simply rename it to foo.pm ( and adjust the apache conf
file of course ) the error magically disappears. If one of the access
handler or authentification handler is under the same namespace as the
main handler, i always get the undefined subroutine error msg.
I'm not sure why or how apache handles this or if it's a bug or if i'm
just too tired and missed something somewhere else. I would appreciate
someone's insight on this. Is it a bug / limitation /... ?
Thanks for your time,
Guillaume
Re: Perl Handlers and namespaces.
Posted by Stas Bekman <st...@stason.org>.
Guillaume wrote:
> I ran into this problem today. I am trying to develope a small
> application server with a few handlers and Apache/1.3.22 .
>
> So I have something that looks like this set up in the apache conf file:
>
> <Location /somewhere>
> <Limit GET POST HEAD>
> Allow from all
> </Limit>
> PerlRequire "startup.pl"
> SetHandler perl-script
> PerlHandler AppServer
>
> AuthName "AppServer"
> AuthType Basic
> PerlAuthenHandler AppServer::Auth
> require valid-user
>
> PerlAccessHandler AppServer::Access
> </Location>
>
> Now, you notice that these packages are all under the same namespace.
> This, somehow, causes an 'Undefined subroutine &AppServer::handler
> called.' each time the server recieves a request from a client. However,
> if i move the main handler into another
> namespace or simply rename it to foo.pm ( and adjust the apache conf
> file of course ) the error magically disappears. If one of the access
> handler or authentification handler is under the same namespace as the
> main handler, i always get the undefined subroutine error msg.
>
> I'm not sure why or how apache handles this or if it's a bug or if i'm
> just too tired and missed something somewhere else. I would appreciate
> someone's insight on this. Is it a bug / limitation /... ?
>
> Thanks for your time,
> Guillaume
>
It's a known kludge/bug:
http://perl.apache.org/guide/porting.html#More_package_name_related_issues
--
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/