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

2000-08-15 Thread Doug MacEachern

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?




RE: Why can't I use a package name under Apache::Registry - whoooohah

2000-07-12 Thread bill chmura


I had tried the telnet to grab the headers already, but...  Your second 
suggestion fixed the problem nicely.  Although I do not understand why 
the exit would cause that problem.  After you said that I remebered 
reading somewhere exits were not good under mod-perl, but they should 
be caught by the Registry handler.  Does the package cause it to not be 
caught or something?

If anyone knows off-hand I would appreciate it, but things are back to 
normal here at camp confusion and I want to thank all of the 
suggestions and help given by the list.

Thanks

-Original Message-
From:   ged [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, July 12, 2000 7:51 AM
To: WBChmura
Cc: ged
Subject:Re: Why can't I use a package name under Apache::Registry

Hi there,

On Tue, 11 Jul 2000, bill chmura wrote:

> #!/opt/perl5/bin/perl
> print "Content-type: text/html\n\n";
> exit;
> 
> If I throw a package name in there [snip] under apache::registry it 
> forwards an unrecognized header to the browser

To see the headers, connect to the server using telnet for example:

telnet www.myservername.com 80

and then issue a request by typing for example:

GET /document.html HTTP/1.0

followed by TWO blank lines.  Tried it without that `exit' call?

73,
Ged.