# everything Do everything: CGI
# handler($r) Do everything: mod_perl
# mod_perl_init($r) Initialization for mod_perl
-# mod_perl_print Faster printing for mod_perl
+# mod_perl_print Faster printing for mod_perl
# sendheaders Send headers
# source($path, $level, $linespec) Read and parse .plp files
# start Start the initialized PLP script
SetHandler perl-script
PerlHandler PLP
PerlSendHeader On
- PerlSetVar PLPcache On
+ PerlSetVar PLPcache On
</Files>
# Who said CGI was easier to set up? :)
ScriptAlias /foo/bar/ /PLP_COMMON/
<Directory /foo/bar/>
- AllowOverride None
- Options +ExecCGI
- Order allow,deny
- Allow from all
+ AllowOverride None
+ Options +ExecCGI
+ Order allow,deny
+ Allow from all
</Directory>
AddHandler plp-document plp
Action plp-document /PLP_COMMON/plp.cgi
=item What does PLP stand for?
-PerlPage. The name used to be HTMPL, but HyperText Markup with Perl Language was too long.
+PerlPage. The name used to be HTMPL, but HyperText Markup with Perl Language
+was too long.
=item Is PLP hard to install?
=item Can I use Perl's CGI module with PLP?
-You certainly can! If you do not want %get and %post and the like, just not use
-them. They will be generated on first access, so if you never access them, the
-hashes are never filled.
+You certainly can! If you do not want %get and %post and the like, just don't
+use them. They will be generated on first access, so if you never access them,
+the hashes are never filled.
If you want to use CGI.pm's header functions, C<select STDOUT;> first, to break
out of PLP's tied C<PLPOUT> filehandle.
=item Why does C<< <($filename)> >> not work?
-C<< <(...)> >> is a compile-time tag, opposed to C<include()>, which is evaluated at
-run-time. At compile time, variables are not yet known, and PLP will try to
+C<< <(...)> >> is a compile-time tag, opposed to C<include()>, which is evaluated
+at run-time. At compile time, variables are not yet known, and PLP will try to
include a file literally called C<$filename>.
<: $filename = 'foo.inc.plp'; include($filename); :>
<: print Entity($user_input); :>
+Be warned that this function also HTMLizes consecutive whitespace and newlines (using and <br> respectively).
+For simple escaping, use L<XML::Quote>. To escape high-bit characters as well, use L<HTML::Entities>.
+
=item EncodeURI LIST
-Replaces characters by their %-encoded values.
+Encodes URI strings according to RFC 3986. All disallowed characters are replaced by their %-encoded values.
In void context, B<changes> the values of the given variables. In other contexts, returns the changed versions.
<a href="/foo.plp?name=<:= EncodeURI($name) :>">Link</a>
+Note that the following reserved characters are I<not> percent-encoded, even though they may have a special meaning in URIs:
+
+ / ? : @ $
+
+This should be safe for escaping query values (as in the example above), but it may be a better idea to use L<URI::Escape> instead.
+
=item DecodeURI LIST
-Decodes %-encoded strings.
+Decodes %-encoded strings. Unlike L<URI::Escape>, it also translates + characters to spaces (as browsers use those).
In void context, B<changes> the values of the given variables. In other contexts, returns the changed versions.