Mailing List Archive

$escmode behaving inconsistently?
Hi,

I want to completely turn off escaping in my application (written in
EMBPERL_OBJECT_APP mode). I have configured it in the Apache
configuration - I tried both with PerlSetEnv EMBPERL_ESCMODE 0 and
with EMBPERL_INPUT_ESCMODE 0. In both cases, it works correctly the
first time I call the system, but for subsequent calls, it returns me
the escaped entities instead (switching $escmode to 7). Even having
this in place, I tried adding a «$escmode=0» to the very top of my
_base.epl... To no avail. I also added the same declaration at the
very beginning of base.pm's init function.

I added this as the first line in _base.epl:

[- warn "Starting with: $escmode"; $escmode = 0 -]

And as the last line:

[- warn "Exiting with : $escmode " -]

After restarting Apache and calling my application a couple of times,
I get this in the logs:

[Tue Mar 27 11:51:55 2007] [warn] [19480]ERR: 32: Warning in Perl code: Starting with: 0 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 2.
[Tue Mar 27 11:51:55 2007] [warn] [19480]ERR: 32: Warning in Perl code: Exiting with : 0 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 39.
[Tue Mar 27 11:51:58 2007] [warn] [19480]ERR: 32: Warning in Perl code: Starting with: 7 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 2.
[Tue Mar 27 11:51:58 2007] [warn] [19480]ERR: 32: Warning in Perl code: Exiting with : 0 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 39.
[Tue Mar 27 11:52:13 2007] [warn] [19480]ERR: 32: Warning in Perl code: Starting with: 7 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 2.
[Tue Mar 27 11:52:13 2007] [warn] [19480]ERR: 32: Warning in Perl code: Exiting with : 0 at /home/gwolf/cvs/comas/trunk/embperl/_base.epl line 39.

Now, even with $escmode as 0 during the whole page generation, the
page still displays with everything escaped.

Of course, I thought I was somehow meddling with escmode. But I swear,
I'm not touching it:

gwolf@mosca:~/cvs/comas/trunk$ grep -ri escmode .
./embperl/_base.epl:[- warn "Starting with: $escmode"; $escmode = 0 -]
./embperl/_base.epl:[- warn "Exiting with : $escmode " -]

Any pointers on what might I be doing wrong?

Thanks,

--
Gunnar Wolf - gwolf@gwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: $escmode behaving inconsistently? [ In reply to ]
Hi,

>
> I want to completely turn off escaping in my application
> (written in EMBPERL_OBJECT_APP mode). I have configured it in
> the Apache configuration - I tried both with PerlSetEnv
> EMBPERL_ESCMODE 0 and with EMBPERL_INPUT_ESCMODE 0. In both
> cases, it works correctly the first time I call the system,
> but for subsequent calls, it returns me the escaped entities
> instead (switching $escmode to 7). Even having this in place,
> I tried adding a $escmode=0 to the very top of my
> _base.epl... To no avail. I also added the same declaration
> at the very beginning of base.pm's init function.
>

Could you send your complete configuration regarding Embperl from your
httpd.conf?

Gerald



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: $escmode behaving inconsistently? [ In reply to ]
Gerald Richter - ECOS GmbH dijo [Mon, Apr 02, 2007 at 04:05:22PM +0200]:
> Could you send your complete configuration regarding Embperl from your
> httpd.conf?
>
> Gerald

Of course. First of all, the
/etc/apache2/mods-available/zembperl.{conf,load} files are IIRC the
stock ones shipped with Debian:

-zembperl.conf--------------------------------------------------------
# The sucky "zembperl" name is so we load after perl

AddType text/html .epl

<IfModule mod_perl.c>
# mod_perl version

PerlModule Embperl

<Files *.epl>
SetHandler perl-script
PerlHandler Embperl
Options ExecCGI
</Files>
</IfModule>

<IfModule !mod_perl.c>
# CGI version

<IfModule mod_actions.c>
Action embperl /cgi-bin/embpcgi.pl
Action embperlobject /cgi-bin/epocgi.pl
Action embperl-fastcgi /cgi-bin/embpfastcgi.pl

AddHandler embperl .epl
</IfModule>
</IfModule>
----------------------------------------------------------------------

-zembperl.load--------------------------------------------------------
# The sucky "zembperl" name is so we load after perl

<IfModule mod_perl.c>
LoadModule embperl_module /usr/lib/perl5/auto/Embperl/Embperl.so
</IfModule>
----------------------------------------------------------------------

Now, regarding my app: It is a bit dirty (this means, I've tried a
couple options which are duplicated), this is strictly from my
development machine:

-comas.conf-----------------------------------------------------------
<IfModule mod_perl.c>
Alias /comas /home/gwolf/cvs/comas/trunk/embperl

PerlSetEnv EMBPERL_ESCMODE 0
PerlSetEnv EMBPERL_OPTIONS 16
PerlSetEnv EMBPERL_MAILHOST mosca.iiec.unam.mx
PerlSetEnv EMBPERL_DEBUG 0
<Location /comas>
EMBPERL_INPUT_ESCMODE 0
EMBPERL_OBJECT_APP base.pm
EMBPERL_APPNAME comas
EMBPERL_OBJECT_FALLBACK index.html
EMBPERL_TOP_INCLUDE "use strict;"
SetHandler perl-script
PerlHandler Embperl::Object
Options ExecCGI
</Location>

<FilesMatch "\.epl$|\.pm$">
Order allow,deny
Deny From all
</FilesMatch>
</IfModule>
----------------------------------------------------------------------

Besides this, and besides loading mod_perl (tell me if that part of
the configuration might be useful), I'm only loading Apache::DBI and
adding /home/gwolf/cvs/comas/trunk/lib at startup, from mod_perl's
configuration.

You might remember some months ago I bothered you for another problem,
regarding just a noisy exit() function - I had to temporarily leave
this project, so I didn't look into it any further... I'll bug you
again with that as well :)

This machine is running Debian Sid (unstable), with the following
versions:

apache2-mpm-prefork 2.2.3-4
libapache2-mod-perl2 2.0.2-2.4
libembperl-perl 2.2.0-1.2

Greetings,

--
Gunnar Wolf - gwolf@gwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF
RE: Re: $escmode behaving inconsistently? [ In reply to ]
Hi,

>
> -comas.conf-----------------------------------------------------------
> <IfModule mod_perl.c>
> Alias /comas /home/gwolf/cvs/comas/trunk/embperl
>
> PerlSetEnv EMBPERL_ESCMODE 0
> PerlSetEnv EMBPERL_OPTIONS 16
> PerlSetEnv EMBPERL_MAILHOST mosca.iiec.unam.mx
> PerlSetEnv EMBPERL_DEBUG 0

In Embperl 2 you should not use PerlSetEnv nor SetEnv, the Embperl setup
uses native Apache configuration directives and the environment will not
be scanned, unless you set "Embperl_UseEnv on" (as Apache directive, not
in the environment).

Gerald


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Re: $escmode behaving inconsistently? [ In reply to ]
Gerald Richter - ECOS GmbH dijo [Tue, Apr 03, 2007 at 06:24:32AM +0200]:
> > -comas.conf-----------------------------------------------------------
> > <IfModule mod_perl.c>
> > Alias /comas /home/gwolf/cvs/comas/trunk/embperl
> >
> > PerlSetEnv EMBPERL_ESCMODE 0
> > PerlSetEnv EMBPERL_OPTIONS 16
> > PerlSetEnv EMBPERL_MAILHOST mosca.iiec.unam.mx
> > PerlSetEnv EMBPERL_DEBUG 0
>
> In Embperl 2 you should not use PerlSetEnv nor SetEnv, the Embperl setup
> uses native Apache configuration directives and the environment will not
> be scanned, unless you set "Embperl_UseEnv on" (as Apache directive, not
> in the environment).

Ok, that seems to have done the trick - And yes, a bit further on I
noticed I had set EMBPERL_INPUT_ESCMODE - Being tired, of course, I
confused it with EMBPERL_ESCMODE (yes, this is my test environment,
and it's no surprise my configuration is quite messy - I'm working on
improving it ;-) )

Thanks again. I'll bug again if some other problems I'm facing don't
disappear ;-)

--
Gunnar Wolf - gwolf@gwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF