(Plain text version)

use PerlHP;

	use strict;

	my $tagline=random_line("taglines.txt")

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en">
<title>PerlHP - <% print $tagline %></title>

<style type="text/css">
body { padding: 0em 1em; }
h1 { background:#eef; font-family: sans-serif; font-size: 1.5em; font-weight: bold; border-bottom:2px solid #ccf }
h2 { color: #336; font-family: sans-serif; font-size: 1.2em; font-weight: bold; border-bottom:1px solid #ddf }
h3 { font-size: 1em; font-weight: bold; }
a { color: #f83; font-family: sans-serif; }
a:visited { color: #d72; }
a:hover { color: #fff; background: #f83; text-decoration: none; }
#footer { font-size: 0.7em; margin-top: 2em; text-align: center; }
#comments { border-top: 1px dashed #ddf; margin-top: 1em }

blockquote { margin-left: 0em; }
blockquote blockquote { font-style: italic; margin-left: 0em; color: #7f7f7f; }
blockquote blockquote em { font-style: normal }
p.signature { border-bottom: 1px dashed #ddf; padding: 0em 0em 0.5em 4em }
p.signature:before { content: "- " }
input, textarea { border: 1px solid #448 ; background: #fff }
input[type=submit] { color: #448; }
input:hover[type=submit] { background: #ccf }
label { font-family: sans-serif; color: #448; }

.fuckoffspammers { display: none; }



<h1>PerlHP - <% print $tagline %></h1>


<p><abbr title="Perl HomePage tools">PerlHP</abbr> is an attempt to give Perl the same
simplicity and hackiness that PHP has spent years trying to forget. It lets you
put together simple dynamic web pages more quickly than writing them in plain Perl, and
with less mental anguish than writing them in PHP. It is also cheerfully obfuscated,
but luckily you don't need to actually look at it to use it.</p>

<p><abbr title="Perl Hypertext Processor">PerlHP</abbr> started out as a <a href="">joke</a>,
but it did turn out to be useful - for instance, I wrote this page using it. It can
reduce both PHP and Perl programmers to incoherent rambling, which I also view as a

<p><abbr title="Perl HP sauce">PerlHP</abbr> works best on a web server with Perl 5.8.0 or
newer, but will also run on Perl 5.6.0 with some tweaking. The current version of PerlHP
is <strong>SE v9.0</strong>.</p>

<h2>Getting it</h2>

<p>There is no automatic installer for PerlHP yet. It is just a single <code>.pm</code> file,
and can either be copied into the Perl <code>lib/</code> directory, or kept in the same
directory as your pages.</p>

<li><a href="">The main PerlHP file</a></li>
<li><a href="PerlHP.html">The PerlHP documentation</a></li>
<li><a href="">Look at the source</a></li>

<h2>Example code</h2>

<li><a href="">A simple test page</a> (<a href="">source</a>)</li>
<li><a href="manfire/manfire.cgi">An image browser</a> (<a href="">source</a>)</li>
<li><a href="">The source for this page</a></li>
<li><a href="">The source code viewer</a></li>


<p><a href="">Michael J. Matthews</a> has converted PerlHP into
a slightly more sane templating engine, and created a CPAN module for it, named
<a href="">Markup::Perl</a>.
This is a good option for people who are not crazy, or just prefer to use code off
CPAN. It has most of the same benefits as PerlHP.</p>

<h2>Release notes</h2>

<h3>SE v9.0:</h3>
<li><code>use strict;</code> now fully supported. It is recommended that you use
this - see the documentation for
<a href="">details</a>.</li>
<li>Re-written parser to properly support including external files with
<code>do</code> and <code>require</code>.
<li>PHP-style short tags (<code>&lt;%= expression %&gt;</code>) are now supported,
and code sections are now implicitly closed at EOF.</li>
<li>No longer uses a temporary file for output, which gives a slight speedup.</li>
<li>Added a PHP-stlye <code>echo()</code> function and <code>%_REQUEST</code>
<li><code>readfile()</code> function added to quickly read external files.</li>
<li>Under Perl 5.6.*, the <code>use PerlHP;</code> statement is now required.</li>
<li><code>perlhp()</code> function for parsing PerlHP code to Perl code added,
to be used for silly hacks.</li>
<li>Some error reporting bugs fixed.</li>


<li>Security fix!</li>


<li><a href="">Perl 5.6.* support</a></li>

<h3>v3.01 Gold</h3>

<li>Beautiful error handling</li>


<li>PerlHP discussion and support requests are welcome in the 
<a href="">PerlHP thread</a>
at the <a href="/sup/">Wakaba and Kareha support board</a>.</li>
<li>The <a href="">4-ch Programming Board</a> is also a good place
to discuss PerlHP and other programming matters.</li>
<li>I've also written several <a href="/">message board scripts</a>, which are used in
such places as <a href="">WAKAchan</a> and
<a href="">4-ch</a>.</li>


<p id="footer">- Powered by PerlHP -</p>


sub random_line($)
	my ($file)=@_;
	my @lines=read_array($file);
	return $lines[rand @lines];

sub read_array($)
	my ($file)=@_;

	open FILE,$file or return ();
	my @array=map { s/\r?\n?$//; $_ } <FILE>;
	close FILE;
	return @array;