#!/usr/bin/perl use PerlHP; <% use strict; our ($plain); my $file=$ENV{PATH_INFO}; $file=~s!^/+!!; die "No haxoring!" if($file=~m!(?:\.\.|//)!); open FILE,$file or die "No such file"; my $source=join "",; close FILE; if($plain) { header("Content-Type: text/plain"); print $source; exit 0; } $file=escape_html($file); $source=escape_html($source); $source=~s{(.*?)(?:(<([\%\?])(?:perl|=|))(\s.*?)?(\3>)|$)}{ my ($html,$start,$code,$end)=($1,$2,$4,$5); $html=~s{(</?)(\w+)(.*?)(>)}{ my ($start,$tagname,$attrs,$end)=($1,$2,$3,$4); $attrs=~s{(\w+\s*)=(\s*(?:("|').*?\3|\S+))}{$1=$2}sg; "$start$tagname$attrs$end" }sge; $code=~s{(?:(("|').*?(?$string" } elsif(length $comment) { "$comment" } else { "$var" } }sge; "$html$start$code$end" }sgei; %> <% print $file %>

<% print $file %> (Plain text version)

<% print $source %>