perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trey Hyde <>
Subject Autoescaping using syntax modes
Date Mon, 21 Aug 2006 21:23:36 GMT
For various reasons, we have escmode set to 0 globally in our
application.  I'm in the process of converting said application to
embperl 2 and I'd like to take advantage of the extendable syntax modes
and do escaping a little more transparently (rather than the explicit
escaping we are doing now).

This working fine for attribute values like:
 $self->AddTag("input", ["id", "name", "type", "value"], undef(),
		  { perlcode => q{
		       _ep_sa(%$n%, 'value',  $epreq->Escape(%&'value%, 5));

But I'm having a little trouble with textareas.

Given this input,

<textarea name="foo">test</textarea>


    $self->AddTag("textarea", ["id", "name", "rows", "cols"], undef(),
		  { perlcode => q{
		      print STDERR "|".XML::Embperl::DOM::Node::iChildsText(%$n%)."|
$epreq->Escape(XML::Embperl::DOM::Node::iChildsText(%$n%), 5));

I'd expect |test| in my logs.   I'm getting ||.  If I change "test" to
something that actually warrants escaping, I will still get the original
text, not the escaped text.

If I change it to 

  $self->AddTag("textarea", ["id", "name", "rows", "cols"], undef(),
		  { perlcode => q{
		      print STDERR "|".XML::Embperl::DOM::Node::iChildsText(%$n%)."|
		      _ep_rp(%$x%, $epreq->Escape("hello world", 5));
I will actually get the following as embperl output.

<textarea name="foo">hello worldtest</textarea>

So I think I'm not understanding some of the functions or special
variables here.  Can anyone lend some help?  Thanks
Running Embperl 2.2 on Apache 1.3.29.


Richard "Trey" Hyde 
Lead Software Engineer, CNET Channel

View raw message