You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Anthony Gardner <cy...@yahoo.co.uk> on 2006/12/14 17:35:07 UTC

syswrite + Apache?

All,
    [input]   [input]   [input]   [input]                                            i have another strange one for the list and i know, before I even ask, that i'll be the only one experiencing this :(

Am using RHEL 1.99??? (Apache2) and under cgi-script  I can succesfully use syswrite(STDOUT, .....

but under ModPerl::Registry, I get Bad file descriptor.

Stupid question but ............. has anyone got any pointers?

ho hum ;)

-Ants
 		
---------------------------------
 All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine

Re: syswrite + Apache?

Posted by Anthony Gardner <cy...@yahoo.co.uk>.
Hmmmm.

Now what am I doing wrong?

I'm trying to tie( *NEWOUT, 'Apache2::RequestIO' ); as per docs ....

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

but I'm getting ..... Can't locate object method "TIEHANDLE" via package "Apache2::RequestIO"

I've tried it under ModPerl::Registry and I've written a handler but same results.

I'd appreciate an pointers. Sorry 'bout this!!

CIA


-Ants





Perrin Harkins <pe...@elem.com> wrote: Alex Beamish wrote:
> I'm going 
> to seriously consider looking through the mod_perl docs to see if 
> there's a way to make sure a reader understands that if they want to do 
> anything with STDOUT .. that they can't.

The tied STDOUT is actually pretty well-documented in my opinion:
http://perl.apache.org/docs/2.0/user/config/config.html#C_perl_script_
http://perl.apache.org/docs/1.0/guide/porting.html#STDIN__STDOUT_and_STDERR_streams
http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html#C_spawn_proc_prog_
http://perl.apache.org/docs/2.0/api/Apache2/RequestIO.html

There's more here about how this affects forking and system():
http://perl.apache.org/docs/1.0/guide/performance.html#Starting_a_Long_Running_External_Program

If there's a place in the docs where you think it would be relevant but 
it isn't mentioned, you're more than welcome to send in a correction. 
There are instructions for checking out the docs source on the website.

- Perrin


 		
---------------------------------
Does your mail provider give you FREE antivirus protection? 
Get Yahoo! Mail

Re: syswrite + Apache?

Posted by Anthony Gardner <cy...@yahoo.co.uk>.
Doh!!

Think I've solved it. I used $r instead of Apache2::RequestIO and it works. Plus, I forgot to uniti STDOUT before tie(ing)

Now, just gotta try it on the ever reliable RHEL 1.99!!!!!



Perrin Harkins <pe...@elem.com> wrote: Alex Beamish wrote:
> I'm going 
> to seriously consider looking through the mod_perl docs to see if 
> there's a way to make sure a reader understands that if they want to do 
> anything with STDOUT .. that they can't.

The tied STDOUT is actually pretty well-documented in my opinion:
http://perl.apache.org/docs/2.0/user/config/config.html#C_perl_script_
http://perl.apache.org/docs/1.0/guide/porting.html#STDIN__STDOUT_and_STDERR_streams
http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html#C_spawn_proc_prog_
http://perl.apache.org/docs/2.0/api/Apache2/RequestIO.html

There's more here about how this affects forking and system():
http://perl.apache.org/docs/1.0/guide/performance.html#Starting_a_Long_Running_External_Program

If there's a place in the docs where you think it would be relevant but 
it isn't mentioned, you're more than welcome to send in a correction. 
There are instructions for checking out the docs source on the website.

- Perrin


 		
---------------------------------
Win tickets to the 2006 FIFA World Cup Germany with Yahoo! Messenger.

Re: syswrite + Apache?

Posted by Perrin Harkins <pe...@elem.com>.
Alex Beamish wrote:
> I'm going 
> to seriously consider looking through the mod_perl docs to see if 
> there's a way to make sure a reader understands that if they want to do 
> anything with STDOUT .. that they can't.

The tied STDOUT is actually pretty well-documented in my opinion:
http://perl.apache.org/docs/2.0/user/config/config.html#C_perl_script_
http://perl.apache.org/docs/1.0/guide/porting.html#STDIN__STDOUT_and_STDERR_streams
http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html#C_spawn_proc_prog_
http://perl.apache.org/docs/2.0/api/Apache2/RequestIO.html

There's more here about how this affects forking and system():
http://perl.apache.org/docs/1.0/guide/performance.html#Starting_a_Long_Running_External_Program

If there's a place in the docs where you think it would be relevant but 
it isn't mentioned, you're more than welcome to send in a correction. 
There are instructions for checking out the docs source on the website.

- Perrin

Re: syswrite + Apache?

Posted by Alex Beamish <ta...@gmail.com>.
On 12/14/06, Perrin Harkins <pe...@elem.com> wrote:
>
> Anthony Gardner wrote:
> > Am using RHEL 1.99??? (Apache2) and under cgi-script  I can succesfully
> > use syswrite(STDOUT, .....
> >
> > but under ModPerl::Registry, I get Bad file descriptor.
>
> STDOUT is tied to apache's output stream under mod_perl.  What are you
> trying to do?


It's interesting that Anthony is coming across the same hurdle that I faced
quite recently.

Once I've figured out how to get my Rube Goldberg contraption going (a
mod_perl request handler communicating through sockets with a daemon that is
itself running interactive programs through IPC::Run), I'm going to
seriously consider looking through the mod_perl docs to see if there's a way
to make sure a reader understands that if they want to do anything with
STDOUT .. that they can't.

-- 
Alex Beamish
Toronto, Ontario
aka talexb

Re: syswrite + Apache?

Posted by Perrin Harkins <pe...@elem.com>.
Anthony Gardner wrote:
> Am using RHEL 1.99??? (Apache2) and under cgi-script  I can succesfully 
> use syswrite(STDOUT, .....
> 
> but under ModPerl::Registry, I get Bad file descriptor.

STDOUT is tied to apache's output stream under mod_perl.  What are you 
trying to do?

- Perrin