You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2000/08/16 07:01:51 UTC

Re: Why can't I use a package name under Apache::Registry

On Tue, 11 Jul 2000, bill chmura wrote:

> 
> Hello,
> 
> I have a problem with using apache::Registry and have not been able 
> find an answer in the eagle book or the mod_perl site, so i am missing 
> something here.  
> 
> If I take the following script and run it under apache::registry it 
> runs fine:
> 
> #!/opt/perl5/bin/perl
> print "Content-type: text/html\n\n";
> exit;
> 
> If I throw a package name in there (like below) it still runs fine as a 
> standalone script and CGI script, but under apache::registry it 
> forwards an unrecognized header to the browser, which I cannot 
> determine what it is.  I have removed the package from the code, but 
> still wonder why I cannot do this?
> 
> #!/opt/perl5/bin/perl
> package myscript;
> print "Content-type: text/html\n\n";
> exit;

because Apache::Registry overrides Perl's builtin exit() in the compiled
script (which has it's own unique namespace).  you're calling exit() in a
different namespace, so exit() is now Perl's builtin exit.  the builtin
exit() calls a c-level exiting, killing the process before Apache's output
buffers have been flushed.
if you're using Perl 5.005+, exit() should be overridden everywhere, what
version are you using?