 2008/05/17
|
Last update 2002/02/12
The Labs - Design & Functionality For The NetInline Perl in HTML-Pages using mod_perl
- Introduction
- Download
- Installation
- Syntax
- Security
- Other Perl Packages
| Inline Perl Pages1. Introduction
|
InlinePerlPages is a very experimental script with use of mod_perl
perl-modules for Apache HTTPD.
It provides following features:
- Inline perl statements: stdout goes to output of resulting page.
- Include files: include html/perl from a page (recursivly).
- No seen CGIs (search-engines parse all your dynamic pages)
| Inline Perl Pages2. Download
|
$MyVersion: 0.010 - Fri May 10 14:08:44 CEST 2002 - kiwi$
IPP.tar.gz
| Inline Perl Pages3. Installation
|
You require to run Apache Web-Server
then install mod_perl, follow the instructions given at http://perl.apache.org.
Unpack and install IPP.pm:
|
tar zxf IPP.tar.gz
|
|
cd IPP
|
|
perl Makefile.PL
|
|
make
|
|
make install
|
then edit your http.conf:
|
<VirtualHost 192.168.0.28>
|
|
ServerAdmin webmaster@host.some_domain.com
|
|
DocumentRoot /mypath/whatever/
|
|
<Location />
|
|
SetHandler perl-script
|
|
# PerlSetVar IPPStrict off
|
|
PerlHandler Apache::IPP
|
|
PerlSendHeader On
|
|
</Location>
|
|
</VirtualHost>
|
Run as root
|
/usr/local/apache/sbin/apachectl restart
|
By default 'use strict' is enabled within all perl-code, if you want to
write unsafe perl-code then remove comment at 'PerlSetVar IPPStrict off'.
| Inline Perl Pages4. Syntax
|
Following inline commands are available:
| #perl ... #/perl | source-code in perl |
| #include <filename> | include a file |
| #include <filename:arg1,arg2,...> | include a file with arguments (they become available as @ARGV) |
| <perl> ... </perl> | source code in perl |
| <include "file"> | include a file |
| <include "file:arg1,arg2,..."> | include a file with arguments |
|
All above tags must start at the beginning of a line and alone on a line.
Sample Code | | Sample test.html, two version which are identical using two different
styles:
|
<title>Sample</title>
|
|
#perl
|
|
open(F,"sample");
|
|
while(<F>) {
|
|
print $_;
|
|
}
|
|
close(F);
|
|
#/perl
|
|
|
|
Another part
|
|
#include <stuff>
|
|
|
<title>Sample</title>
|
|
<perl>
|
|
open(F,"sample");
|
|
while(<F>) {
|
|
print $_;
|
|
}
|
|
close(F);
|
|
</perl>
|
|
|
|
Another part
|
|
<include "stuff">
|
|
Available variables
- %in has all (possible) CGI variables (GET/POST)
- %ENV contains all CGI related variables like in normal CGIs
Be careful when changing global variables with in-line perl since it's not sure
a script is excecuted in its entirety, httpd may terminate the perl-code at any point.
|
| Inline Perl Pages5. Security
|
Security is always a problem on the net, especially on web-servers.
InlinePerlPages is powerful, and therefore following recommendations
should be considered:
- Don't allow any web-user to write HTML pages at all.
- Don't use guestbooks, or threaded discussions which create HTML pages direct,
web-user could enter malicious #perl code by themselves.
- Use guestbooks or discussion-forums which store their submission as
text or HTML in separate file(s) (but not .html pages); those files you include from an InlinePerlPages page. This
way the data doesn't get interpreted by InlinePerlPages and #perl
and #include don't take any effect.
- In general, anything which is requested direct via http:// is wrapped
via InlinePerlPages; anything you include (read from a file or db) within an
InlinePerlPages is not interpreted.
| Inline Perl Pages6. Other Perl Packages
|

Last update 2002/02/12 
All Rights Reserved - (C) 1997 - 2008 by The Labs.Com |