| Category: | CGI |
| Author/Contact Info | Stephen Dolan, stedolan@gmail.com |
| Description: | With this module, you can put Perl code inline in your HTML files, like PHP does. For example:
becomes
|
#!/usr/bin/perl
########## InlineWeb.pm
package InlineWeb;
use Filter::Simple;
FILTER{
my $program="";
while (1){
if (/\G{{/gc){
/\G({+)/gc;
my $braces = $1;
$braces=~tr/{/}/;
/\G(.*?)}}$braces/gcs;
$program.=$1.qq[;\n];
next;
}elsif (/\G{\[/gc){
/\G(\[+)/gc;
my $sq = $1;
$sq=~tr:\[:\]:;
/\G(.*?)$sq]}/gcs;
$program.=q[print scalar ].$1.qq[;\n];
next;
}else{
/\G(.*?)(?=({\[|{{|$))/gcs;
my $txt = $1;
my $delim = $2;
$txt=~s:':\\':g;
$program.=q[print '].$txt.qq[';\n];
next if $delim;
}
last;
}
$_=$program;
return $done=1;
};
1;
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: InlineWeb
by jeffa (Bishop) on Jan 24, 2006 at 21:58 UTC | |
by Anonymous Monk on Jan 25, 2006 at 22:58 UTC | |
|
Re: InlineWeb
by Aristotle (Chancellor) on Jan 26, 2006 at 00:24 UTC | |
|
Re: InlineWeb
by wazoox (Prior) on Jan 25, 2006 at 15:38 UTC |