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?
RE: Why can't I use a package name under Apache::Registry - whoooohah
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.
Why can't I use a package name under Apache::Registry
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; Thanks for any answers!
Why can't I use a package name under Apache::Registry (Continued)
Thats another weird thing. When it was happening I took that Win32::Internet() module and wrote a script to display the headers for a page I entered. It would show the headers for every page except this one! Its like it is not sending anything back. Just as a sanity check, I followed the manual way you described below and and got nothing - just disconnected. I tried the same thing to the "non-packaged" part and got the correct headers back. Nothing in the error_log either. -Original Message- From: darren [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, July 11, 2000 3:29 PM To: WBChmura Cc: darren Subject: Re: Why can't I use a package name under Apache::Registry bill chmura ([EMAIL PROTECTED]) said something to this effect: 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; Thanks for any answers! Run this on a server, connect to it via telnet, and send us the output from the browser: bash$ telnet myhost 80 GET /myscript.pl HTTP/1.0 Host: myhost ...then you can see exactly what Apache is sending. (darren) -- Going to church does not make a person religious, nor does going to school make a person educated, any more than going to a garage makes a person a car.