You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Stefan Cars <st...@snowfall.se> on 2003/07/04 11:51:42 UTC

Problems using IPC::Open3 & IPC::Run3

Hi!

I had an subroutine which used IPC::Open3, now I understand that
IPC::Open3 is no good when you use it with modperl/embperl and heard that
I should use IPC::Run3 instead although when using that all I get is
errors like "[55832]ERR: 24: Error in Perl code: Bad file descriptor
closing STDIN".

Is there anyway to use IPC::Open3 or anything like it or is there another
module doing the same thing which can be used with embperl ?

/ Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Problems using IPC::Open3 & IPC::Run3

Posted by Stefan Cars <st...@snowfall.se>.
Thanks!

It seems to be working perfectly fine so I'll just go with it!

On Mon, 7 Jul 2003, Donovan Allen wrote:

> I have never had problems after doing the untie.
>
> My premise as to why this seems to be an ok thing to do is:
> * If you modify the work around code to some sort of debug output everytime
> $tie_stdin is defined, you will see that STDIN gets tied by mod_perl every
> request.
> * Also, my assumption is that the tied STDIN has already served its purpose for
> the request by the time we get to the embperl scripts.  This could be incorrect,
> but I have not had anything break because of it.
>
> I am lazy, so as long as something isn't broken and seems to be working as
> intended, I generally stop fiddling with it unless I am looking for trouble.
>
> It might be possible to create a protected copy of STDIN, but I did a quick
> duplicate protection test and it seems that the duplicated handle is not tied, so
> something is amiss and protecting tied filehandles may not be possible...then
> laziness kicked in. :-)
>
> Ultimately, the mod_perl maintainers may be a better source for more details and
> explanations, since they broke STDIN in the first place.
>
> Then again, if you ask me, the mod_perl maintainers should also do more or less
> one of the following:
>   a> create their own duped STDIN to tie and mangle
>   b> fix the tie code to handle all the common downstream STDIN uses
>   c> or untie it if they are done with it so we don't have to guess, worry, and/or
> dig around for answers to potentially harmless concerns.
>
> Cheers,
> Donovan Allen
>
> Stefan Cars wrote:
>
> > Okey but shouldn't i tie it back some how ?
> >
> > /S
> >
> > On Sat, 5 Jul 2003, Donovan Allen wrote:
> >
> > > Found this somewhere back when this bug first appeared in mod_perl:
> > >
> > > # work-around for mod_perl
> > > my $tie_stdin = tied *STDIN;
> > > untie *STDIN if $tie_stdin;
> > >
> > > # insert open2() or open3() statement after the above
> > >
> > > Gerald,
> > >
> > > It is a mod_perl bug, but I would consider putting it in the FAQ.  Would
> > > probably be very helpful to people.
> > >
> > > Gerald Richter wrote:
> > >
> > >  Is there anyway to use IPC::Open3 or anything like it or is there another
> > > module doing the same thing which can be used with embperl ?
> > >
> > >
> > >
> > >  Sorry, I don't know a solution. Maybe you can find something in the modperl
> > > guide (perl.apache.org) or go ask on the modperl mailing list
> > >
> > > Gerald
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > > For additional commands, e-mail: embperl-help@perl.apache.org
> > >
> > >
> > >
> > >
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Problems using IPC::Open3 & IPC::Run3

Posted by Donovan Allen <al...@votehere.net>.
I have never had problems after doing the untie.

My premise as to why this seems to be an ok thing to do is:
* If you modify the work around code to some sort of debug output everytime
$tie_stdin is defined, you will see that STDIN gets tied by mod_perl every
request.
* Also, my assumption is that the tied STDIN has already served its purpose for
the request by the time we get to the embperl scripts.  This could be incorrect,
but I have not had anything break because of it.

I am lazy, so as long as something isn't broken and seems to be working as
intended, I generally stop fiddling with it unless I am looking for trouble.

It might be possible to create a protected copy of STDIN, but I did a quick
duplicate protection test and it seems that the duplicated handle is not tied, so
something is amiss and protecting tied filehandles may not be possible...then
laziness kicked in. :-)

Ultimately, the mod_perl maintainers may be a better source for more details and
explanations, since they broke STDIN in the first place.

Then again, if you ask me, the mod_perl maintainers should also do more or less
one of the following:
  a> create their own duped STDIN to tie and mangle
  b> fix the tie code to handle all the common downstream STDIN uses
  c> or untie it if they are done with it so we don't have to guess, worry, and/or
dig around for answers to potentially harmless concerns.

Cheers,
Donovan Allen

Stefan Cars wrote:

> Okey but shouldn't i tie it back some how ?
>
> /S
>
> On Sat, 5 Jul 2003, Donovan Allen wrote:
>
> > Found this somewhere back when this bug first appeared in mod_perl:
> >
> > # work-around for mod_perl
> > my $tie_stdin = tied *STDIN;
> > untie *STDIN if $tie_stdin;
> >
> > # insert open2() or open3() statement after the above
> >
> > Gerald,
> >
> > It is a mod_perl bug, but I would consider putting it in the FAQ.  Would
> > probably be very helpful to people.
> >
> > Gerald Richter wrote:
> >
> >  Is there anyway to use IPC::Open3 or anything like it or is there another
> > module doing the same thing which can be used with embperl ?
> >
> >
> >
> >  Sorry, I don't know a solution. Maybe you can find something in the modperl
> > guide (perl.apache.org) or go ask on the modperl mailing list
> >
> > Gerald
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> >
> >
> >
> >
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Problems using IPC::Open3 & IPC::Run3

Posted by Stefan Cars <st...@snowfall.se>.
Okey but shouldn't i tie it back some how ?

/S

On Sat, 5 Jul 2003, Donovan Allen wrote:

> Found this somewhere back when this bug first appeared in mod_perl:
>
> # work-around for mod_perl
> my $tie_stdin = tied *STDIN;
> untie *STDIN if $tie_stdin;
>
> # insert open2() or open3() statement after the above
>
> Gerald,
>
> It is a mod_perl bug, but I would consider putting it in the FAQ.  Would
> probably be very helpful to people.
>
> Gerald Richter wrote:
>
>  Is there anyway to use IPC::Open3 or anything like it or is there another
> module doing the same thing which can be used with embperl ?
>
>
>
>  Sorry, I don't know a solution. Maybe you can find something in the modperl
> guide (perl.apache.org) or go ask on the modperl mailing list
>
> Gerald
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Problems using IPC::Open3 & IPC::Run3

Posted by Gerald Richter <ri...@ecos.de>.
>
> Is there anyway to use IPC::Open3 or anything like it or is there another
> module doing the same thing which can be used with embperl ?
>

Sorry, I don't know a solution. Maybe you can find something in the modperl
guide (perl.apache.org) or go ask on the modperl mailing list

Gerald


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org