You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Danial Pearce <da...@infoxchange.net.au> on 2003/10/27 08:56:11 UTC

mod_perl STDOUT on OS X Panther

So I bought Panther the other day. Turns out apple have done the right 
thing this time and shipped with the latest Apache. Which is great, I 
remember the rigmarole I went through with Jaguar to get a working 
Apache/mod_perl/libapreq set up. However, they have not shipped the 
latest mod_perl.

A quick look with Apache::Status tells me that it's 1.26 compiled with 
everything.

My issue is, in a PerlHandler, usually doing print "foo\n" will print 
it to the browser. This is not happening with the default Panther 
install.

I can fix this by changing the call to $r->print("foo\n") instead, but 
there are just so many places I would have to change it.

I can also fix it by installing mod_perl 1.29, which also works fine, 
but if possible I would like to keep to what Apple ship, so I don't 
inadvertently break my entire set up when they release a patch.

Any ideas why the normal STDOUT is not the browser? Is there a global 
place I can tie it in? E.g. Load some other perlhandler early on in the 
peace so that it gets tied properly for all subsequent perlhandlers?

cheers
Danial Pearce

PS: Please cc me on replies, not subscribed.


Re: mod_perl STDOUT on OS X Panther

Posted by Stas Bekman <st...@stason.org>.
Danial Pearce wrote:
> So I bought Panther the other day. Turns out apple have done the right 
> thing this time and shipped with the latest Apache. Which is great, I 
> remember the rigmarole I went through with Jaguar to get a working 
> Apache/mod_perl/libapreq set up. However, they have not shipped the 
> latest mod_perl.
> 
> A quick look with Apache::Status tells me that it's 1.26 compiled with 
> everything.
> 
> My issue is, in a PerlHandler, usually doing print "foo\n" will print it 
> to the browser. This is not happening with the default Panther install.
> 
> I can fix this by changing the call to $r->print("foo\n") instead, but 
> there are just so many places I would have to change it.
> 
> I can also fix it by installing mod_perl 1.29, which also works fine, 
> but if possible I would like to keep to what Apple ship, so I don't 
> inadvertently break my entire set up when they release a patch.

If you rely on Apache for your business I would go with your hand-made latest 
version of Apache/mod_perl and not depend on your distro precompiled thing.

> Any ideas why the normal STDOUT is not the browser? Is there a global 
> place I can tie it in? E.g. Load some other perlhandler early on in the 
> peace so that it gets tied properly for all subsequent perlhandlers?

STDOUT is normally tied to the 'Apache' class. I don't know why it doesn't 
work for you in 1.26. It's possible that you run some code that 
re-ties/re-opens STDOUT to something else, but that is probably not a case, 
since you say it's working fine with 1.29.

But you could fix it in PerlTransHandler or some earlier phase, like so:

   tie STDOUT, 'Apache' unless tied STDOUT;

See:
http://perl.apache.org/docs/1.0/guide/porting.html#STDIN__STDOUT_and_STDERR_streams

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com