
Richard.Hyde at cnet
Aug 21, 2006, 2:23 PM
Views: 1668
Permalink
|
|
Autoescaping using syntax modes
|
|
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(), 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> and $self->AddTag("textarea", ["id", "name", "rows", "cols"], undef(), undef(), { perlcode => q{ print STDERR "|".XML::Embperl::DOM::Node::iChildsText(%$n%)."| \n"; _ep_rp(%$x%, $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(), undef(), { perlcode => q{ print STDERR "|".XML::Embperl::DOM::Node::iChildsText(%$n%)."| \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 Richard.Hyde [at] cnet
|