You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Ilia Lobsanov <il...@lobsanov.com> on 2000/12/07 06:33:12 UTC

Embperl $optRedirectStdout doesn't seem to work

The following script doesn't seem to work as expected:

------------------cut-----------------
[-
$optRedirectStdout = 1;
-]

Hello1<BR>

[-
print "Hello2";
-]
------------------cut-----------------

I only get "Hello1".

This happens on Embperl 1.3b5 and Embperl 1.3b6, in combination with
$escmode = 0, optRawInput = 1, optDisableFormData = 1.
Same thing happens without these options.

I know I can use "print OUT ..." but I'd rather not.

For now, I had to do this:
[-
tie *STDOUT, 'IO::Scalar', \$s;
SomeModule::lotsaPrints();
-]
[+ $s +]

ilia.


Re: Embperl $optRedirectStdout doesn't seem to work

Posted by Gerald Richter <ri...@ecos.de>.
>
> Ok, however, setting it in httpd.conf results in problems with other
> parts of the site. It would be nice to be able to set
> it per page, don't you think? Would it be possible to patch embperl to
> use IO::Scalar in this case?
>

You have two possibilites, either say it in your httpd.conf, just for that
file, something like

<Files foo.epl>
    PerlSetEnv EMBPERL_OPTIONS 16384
..

<Files>

or do a

[! sub CLEANUP {select ($oldstdout)} !]
[- $oldstdout = select (OUT) -]

I didn't tried the second possibility, but it should work. It changes stdout
to go to OUT and the CLEANUP sub will restore it.

While your IO::Scalar works also, it's a little slower, because output has
first to go to the scalar

Gerald



-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




Re: Embperl $optRedirectStdout doesn't seem to work

Posted by Ilia Lobsanov <il...@lobsanov.com>.
Gerald Richter wrote:

> > The following script doesn't seem to work as expected:
> >
> > ------------------cut-----------------
> > [-
> > $optRedirectStdout = 1;
> > -]
> >
>
> optRedirectStdout can't be set inside a page, it must be set in the
> httpd.conf. See:
>
> http://perl.apache.org/embperl/Embperl.pod.6.html#_optXXX_dbgXXX
>
> Gerald

Ok, however, setting it in httpd.conf results in problems with other
parts of the site. It would be nice to be able to set
it per page, don't you think? Would it be possible to patch embperl to
use IO::Scalar in this case?

ilia.


Re: Embperl $optRedirectStdout doesn't seem to work

Posted by Gerald Richter <ri...@ecos.de>.
> The following script doesn't seem to work as expected:
>
> ------------------cut-----------------
> [-
> $optRedirectStdout = 1;
> -]
>


optRedirectStdout can't be set inside a page, it must be set in the
httpd.conf. See:

http://perl.apache.org/embperl/Embperl.pod.6.html#_optXXX_dbgXXX

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------