perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Mak <>
Subject $Server->HTMLEncode, single quotes, and .pm files
Date Sat, 01 Jun 2002 16:31:14 GMT
Perhaps this should be added to the $Server->HTMLEncode() regexp in


The reason is that the following code will not perform as expected:

print "<INPUT TYPE='TEXT' VALUE='".$Server->HTMLEncode("You're")."'>";

It will become this:


which is invalid HTML.

Here's why I ended up using single quotes instead of double quotes:

Single quotes are valid in HTML, and in Perl code it's useful to use
single quotes in 'print' statements. I couldn't use the <%= %>
notation because I was writing code in an XMLSub .pm file and the sub
was only a few lines long so I didn't want to $Response->Include.

Going off on a tangent, is it possible to do something like this in an
XMLSub file (probably not valid Perl syntax, but it explains the

for (qw(select text textarea)) {
  sub $_ { $main::Response->Include("$", @_) }

instead of manually typing:

sub select { $main::Response->Include('', @_) }
sub text { $main::Response->Include('', @_) }
sub textarea { $main::Response->Include('', @_) }

It just occured to me that I'm always using XMLSubs to generate HTML,
so it would be cleaner to write them in ASP style instead of Perl

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message