Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Fix mod_perl print() output UNIX
The Apache build that comes with Panther does include mod_perl, but for some reason the output of the standard Perl print() routine is not redirected to the web browser as it should be. You can always build your own Apache to solve the problem, but this solution is easier. Just add the following line to your /etc/httpd/httpd.conf file:

PerlTransHandler "sub { tie *STDOUT, 'Apache' unless tied *STDOUT;  }"
[robg adds: I haven't tested this one...]
  • Currently 2.67 / 5
  You rated: 4 / 5 (6 votes cast)

10.3: Fix mod_perl print() output | 4 comments | Create New Account
Click here to return to the '10.3: Fix mod_perl print() output' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: mblythe on Dec 05, '03 06:01:04PM
After submitting this hint, I found that using this as a PerlTransHandler can interfere with static file retrieval. Changing it to a PerlHeaderParserHandler still solves the original mod_perl problem without causing any others (as far as I can tell).

PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless tied *STDOUT; }"

[ Reply to This | # ]
10.3: Fix mod_perl print() output
Authored by: dontlikehippies on Dec 07, '03 06:51:46AM

I tried both suggestions, and both times Personal Web Sharing refused to start. After commenting-out the line, everything works as usual...

[ Reply to This | # ]
10.3: Fix mod_perl print() output
Authored by: jorist on Dec 08, '03 07:42:36AM

mod_perl is'nt activated by default. If you plan to use mod_perl enable in in http.conf (remove the #):
LoadModule perl_module libexec/httpd/
AddModule mod_perl.c

[ Reply to This | # ]
10.3: Fix mod_perl print() output
Authored by: brainspiral on Jan 07, '04 07:03:30PM

I came across a broken mod_perl in the distributed versions of both 10.3 & 10.3 Server. I really needed mod_perl to run a calendar program that otherwise is terribly slow in plain cgi.

After having looked all over for solutions, I never really found what I was looking for. Nothing worked. I tried all sorts of things - changing entries in httpd.conf, moving around files, starting/stopping processes, etc. Nothing.

Finally, I decided to rebuild MOD_PERL from source. I really wanted to avoid it - the distributed versions of certain modules are easily broken by updates and I didn't want to go about making drastic changes to a rather complexly installed httpd (with hfs, webdav, calendar, etc modules already configured for use).

So, I found a fairly clean solution that so far has been working great. Here are the steps:

1) Make sure the Panther Developer Tools are installed. You'll need make,gcc & the Perl header files to rebuild mod_perl.

2) Choose a place to build mod_perl. I picked out /usr/src - but anywhere will do. No need to sudo/su yet. Just make sure the user you're logged in as has rwx rights to the folder you download the source to.

3) Get the mod_perl source. I downloaded version 1.29 from:

If you issue the following command from the command line:
The file will be downloaded automatically to the current directly.

4) Unzip it:

tar -zxvf mod_perl-1.0-current.tar.gz

5) Install the CPAN mod_perl libraries (I'm not 100% sure if this step is optional or not)
sudo perl -MCPAN -e 'install("Bundle::Apache")'
(Choose the defaults for install questions)

6) Change directories to the mod_perl source.

cd /usr/src/mod_perl-1.29

7) Issue the configure command. By building mod_perl as a DSO integrated with APXS, I avoided having to rebuild & reconfigure apache.

perl Makefile.PL USE_APXS=1 WITH_APXS=/usr/sbin/apxs EVERYTHING=1 NO_HTTPD=1

8) sudo make

9) sudo make test (make sure all the tests that run pass successfully)

10) sudo make install

11) Stop & Start Apache (either apachectl stop/apachectl start, in Server Admin, or in the 'Sharing' System Preference.

12) Enjoy!

13) FYI: mod_perl does still need to be enabled & configured (in some cases) in httpd.conf.

hunter greene
brainspiral technologies

[ Reply to This | # ]