eperl-2.2.14/eg/demo.env.iphtml 100664 1750 1750 30 6434056037 13674 0 ustar rse en #include demo.env.phtml eperl-2.2.14/eg/demo.env.phtml 100664 1750 1750 1036 6434056037 13572 0 ustar rse endemo.cgipm
High-level HTTP programming with CGI.pm
This demonstrates how one can create complex HTTP headers like Netscape Cookies by programming them via Perl's CGI::Cookie module.
You have accessed this demo =$cnt_value!> times now. This counter is stored in a cookie, so push your RELOAD button a few times to see the effect.
eperl-2.2.14/eg/demo.errout.iphtml 100664 1750 1750 33 6434056037 14427 0 ustar rse en #include demo.errout.phtml eperl-2.2.14/eg/demo.errout.phtml 100664 1750 1750 663 6434056037 14307 0 ustar rse endemo.env
Standard CGI Example: Environment
This prints out the CGI environment provided by the Webserver as a sorted list consisting of key/value pairs.
my $key; foreach $key (sort(keys(%ENV))) { print "$key=$ENV{$key}\n"; } !>
eperl-2.2.14/eg/demo.errsyn.iphtml 100664 1750 1750 33 6434056037 14431 0 ustar rse en #include demo.errsyn.phtml eperl-2.2.14/eg/demo.errsyn.phtml 100664 1750 1750 664 6434056037 14312 0 ustar rse enePerl error page: caused by output on STDERR
First pure text, then... print STDERR "data on STDERR which leads to an error"; !> ...and then again pure text.
eperl-2.2.14/eg/demo.func.iphtml 100664 1750 1750 31 6434056037 14040 0 ustar rse en #include demo.func.phtml eperl-2.2.14/eg/demo.func.phtml 100664 1750 1750 1757 6434056037 13747 0 ustar rse endemo.errsyn
ePerl error page: caused by a syntax error
# the following Pascal'isch line leads # to a syntax error inside ePerl $name := "value"; !>
eperl-2.2.14/eg/demo.html.iphtml 100664 1750 1750 31 6434056037 14051 0 ustar rse en #include demo.html.phtml eperl-2.2.14/eg/demo.html.phtml 100664 1750 1750 1460 6434056037 13747 0 ustar rse endemo.func
Perl Programming
sub ctime { my ($time) = @_; my @dow = ( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ); my @moy = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time); my ($str) = sprintf("%s %s %2d %02d:%02d:%02d 19%s%s", $dow[$wday], $moy[$mon], $mday, $hour, $min, $sec, $year, $isdst ? " DST" : ""); return $str; } !> This demonstrates the global scoping within a webpage by defining a Perl function in a first ePerl block and later calling this function in another ePerl block.
Local time is =&ctime(time())!>.
eperl-2.2.14/eg/demo.image.iphtml 100664 1750 1750 32 6434056037 14170 0 ustar rse en #include demo.image.phtml eperl-2.2.14/eg/demo.image.phtml 100664 1750 1750 3517 6434766463 14105 0 ustar rse en ## ## demo.image -- ePerl demonstration webpage ## Copyright (c) 1996,1997 Ralf S. Engelschall, All Rights Reserved. ## use GD; if (not $ENV{'QUERY_STRING'}) { ## ## THE PAGE ITSELF ## !>demo.html
High-level HTML programming with HTML::Stream
This demonstrates how one can use the HTML-Stream package from within ePerl to do high-level HTML programming. use HTML::Stream; my $HTML = new HTML::Stream \*STDOUT; !> First, a programmed hyperlink to $HTML-> A(HREF=>"http://www.engelschall.com/sw/eperl/")-> t("the ePerl webarea")-> _A; !> .
Second, just $HTML->t("plain text with umlaut characters: äöüÄÖÜß\n" ); !>.
These were automatically converted from ISO-Latin-1 encoding to HTML entities.
} elsif ($ENV{QUERY_STRING} eq 'image=theimage.gif') { ## ## THE INLINED IMAGE ## my $im = new GD::Image(200,140); $im->interlaced('true'); for (my $b = 0; $b <= 255; $b += 51) { for (my $r = 0; $r <= 255; $r += 51) { for (my $g = 0; $g <= 255; $g += 51) { my $x = (($b / 51) % 3)*60 + (60-($r / 51) * 10); my $y = (($b / 51) < 3 ? 0 : 1)*60 + (60-($g / 51) * 10); my $col = $im->colorAllocate($r,$g,$b); $im->rectangle($x, $y, $x+9, $y+9, $col); $im->fill($x+2, $y+2, $col); } } } my $C = $im->gif; print "Content-type: image/gif\n"; printf "Content-length: %d\n", length($C); print "\n"; print $C; } !> eperl-2.2.14/eg/demo.lwp.iphtml 100664 1750 1750 30 6434056037 13706 0 ustar rse en #include demo.lwp.phtml eperl-2.2.14/eg/demo.lwp.phtml 100664 1750 1750 1370 6434056037 13605 0 ustar rse endemo.image
Graphics programming with GD
This demonstrates how you can create a webpage with an inlined GIF image which itself is generated on-the-fly from within this page. In other words: the image is part of the webpage source, too. The trick here is that the complete page is surrounded with an ePerl block and according to the QUERY_STRING the script either produces the page itself (pure HTML) or the image by programming it on-the-fly with the GD module. The link to the image is done via a self-referencing URL.
As an example, we present an on-the-fly generared GIF image showing the Web216 color palette (the ``browser-safe'' colors):
![]()
eperl-2.2.14/eg/demo.net.iphtml 100664 1750 1750 30 6434056037 13672 0 ustar rse en #include demo.net.phtml eperl-2.2.14/eg/demo.net.phtml 100664 1750 1750 2122 6434056037 13565 0 ustar rse endemo.lwp
High-level Network programming with LWP::Simple
This demonstrates how one can use the LWP::Simple package (from libwww-perl) from within ePerl to retrieve a file via HTTP. As an example the ePerl distribution README file is fetched from http://www.engelschall.com/sw/eperl/distrib/eperl-SNAP/.
And here comes the file:
use LWP::Simple; my $data = get("http://www.engelschall.com/sw/eperl/distrib/eperl-SNAP/README"); print $data; !>
eperl-2.2.14/eg/demo.pp.iphtml 100664 1750 1750 27 6434056037 13531 0 ustar rse en #include demo.pp.phtml eperl-2.2.14/eg/demo.pp.phtml 100664 1750 1750 1251 6434056037 13420 0 ustar rse endemo.net
Low-level Network programming with Net::FTP
This demonstrates how one can use the Net::FTP package (from libnet) from within ePerl to retrieve a file via FTP. As an example the ePerl distribution README file is fetched from ftp://ftp.engelschall.com/sw/ while the current filename (ePerl version!) is determined on-the-fly.
And here comes the file:
use Net::FTP; my $tmpfile = "/tmp/demo.net.tmp.$$"; # retrieve the file a temporary file my $ftp = Net::FTP->new("ftp.engelschall.com"); $ftp->login("ftp", "demo.ftp\@"); $ftp->cwd("/sw"); my ($f) = grep(/^eperl-.*\.readme$/, $ftp->ls("eperl-*.readme")); $ftp->get($f, $tmpfile); $ftp->quit; # read the temporary file into current page open(FP, "<$tmpfile"); while () { print $_; } close(FP); unlink($tmpfile); !>
eperl-2.2.14/eg/demo.table.iphtml 100664 1750 1750 32 6434056037 14175 0 ustar rse en #include demo.table.phtml eperl-2.2.14/eg/demo.table.phtml 100664 1750 1750 1633 6434056037 14074 0 ustar rse endemo.pp
Special feature: the ePerl preprocessor
This demonstrates how one can use the ePerl preprocessor. We again (as in demo.lwp) retrieve a file via HTTP. As an example the ePerl distribution README file is fetched from http://www.engelschall.com/sw/eperl/distrib/eperl-SNAP/.And here comes the file:
#sinclude "http://www.engelschall.com/sw/eperl/distrib/eperl-SNAP/README"
eperl-2.2.14/eg/demo.text.iphtml 100664 1750 1750 31 6434056037 14071 0 ustar rse en #include demo.text.phtml eperl-2.2.14/eg/demo.text.phtml 100664 1750 1750 510 6434056037 13742 0 ustar rse en Content-type: text/plain ## ## demo.text -- ePerl demonstration webpage ## Copyright (c) 1996,1997 Ralf S. Engelschall, All Rights Reserved. !> demo.func Low-level HTTP programming This demonstrates how one can prefix the ePerl file with plain HTTP headers which are directly put into the HTTP response header block. eperl-2.2.14/eperl.1 100664 1750 1750 121430 6561064031 11642 0 ustar rse en .rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .ie n \{\ .ds -- \(*W- .ds PI pi .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH EPERL 1 "EN" "2/Aug/98" "Ralf S. Engelschall" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" ePerl \- Embedded Perl 5 Language .SH "VERSION" 2.2.14 (02-08-1998) .SH "SYNOPSIS" \fBeperl\fR [\fB\-d\fR \fIname\fR=\fIvalue\fR] [\fB\-D\fR \fIname\fR=\fIvalue\fR] [\fB\-B\fR \fIbegin_delimiter\fR] [\fB\-E\fR \fIend_delimiter\fR] [\fB\-i\fR] [\fB\-m\fR \fImode\fR] [\fB\-o\fR \fIoutputfile\fR] [\fB\-k\fR] [\fB\-I\fR \fIdirectory\fR] [\fB\-P\fR] [\fB\-C\fR] [\fB\-L\fR] [\fB\-x\fR] [\fB\-T\fR] [\fB\-w\fR] [\fB\-c\fR] [\fIinputfile\fR] .PP \fBeperl\fR [\fB\-r\fR] [\fB\-l\fR] [\fB\-v\fR] [\fB\-V\fR] .SH "DESCRIPTION" .Sh "Abstract" ePerl interprets an \s-1ASCII\s0 file bristled with Perl 5 program statements by evaluating the Perl 5 code while passing through the plain \s-1ASCII\s0 data. It can operate in various ways: As a stand-alone Unix filter or integrated Perl 5 module for general file generation tasks and as a powerful Webserver scripting language for dynamic \s-1HTML\s0 page programming. .Sh "Introduction" The \fBeperl\fR program is the \fIEmbedded Perl 5 Language\fR interpreter. This really is a full-featured Perl 5 interpreter, but with a different calling environment and source file layout than the default Perl interpreter (usually the executable \fBperl\fR or \fBperl5\fR on most systems). It is designed for general \s-1ASCII\s0 file generation with the philosophy of \fIembedding\fR the Perl 5 program code into the \s-1ASCII\s0 data instead of the usual way where you embed the \s-1ASCII\s0 data into a Perl 5 program (usually by quoting the data and using them via \f(CWprint\fR statements). So, instead of writing a plain Perl script like .PP .Vb 6 \& #!/path/to/perl \& print "foo bar\en"; \& print "baz quux\en"; \& for ($i = 0; $i < 10; $i++) { print "foo #${i}\en"; } \& print "foo bar\en"; \& print "baz quux\en"; .Ve you can write it now as an ePerl script: .PP .Vb 6 \& #!/path/to/eperl \& foo bar \& baz quux \& <: for ($i = 0; $i < 10; $i++) { print "foo #${i}\en"; } :> \& foo bar \& baz quux .Ve Although the ePerl variant has a different source file layout, the semantic is the same, i.e. both scripts create exactly the same resulting data on \f(CWSTDOUT\fR. .Sh "Intention" ePerl is simply a glue code which combines the programming power of the Perl 5 interpreter library with a tricky embedding technique. The embedding trick is this: it converts the source file into a valid Perl script which then gets \fIentirely\fR evaluated by only one internal instance of the Perl 5 interpreter. To achieve this, ePerl translates all plain code into (escaped) Perl 5 strings placed into \fIprint\fR constructs while passing through all embedded native Perl 5 code. As you can see, ePerl itself does exactly the same internally, a silly programmer had to do when writing a plain Perl generation script. .PP Due to the nature of such bristled code, ePerl is really the better attempt when the generated \s-1ASCII\s0 data contains really more static as dynamic data. Or in other words: \fIUse ePerl if you want to keep the most of the generated \s-1ASCII\s0 data in plain format while just programming some bristled stuff.\fR Do not use it when generating pure dynamic data. There it brings no advantage to the ordinary program code of a plain Perl script. So, the static part should be at least 60% or the advantage becomes a disadvantage. .PP ePerl in its origin was actually designed for an extreme situation: as a webserver scripting-language for on-the-fly \s-1HTML\s0 page generation. Here you have the typical case that usually 90% of the data consists of pure static \s-1HTML\s0 tags and plain \s-1ASCII\s0 while just the remaining 10% are programming constructs which dynamically generate more markup code. This is the reason why ePerl beside its standard Unix filtering runtime-mode also supports the \s-1CGI/1\s0.1 and \s-1NPH\s0\-\s-1CGI/1\s0.1 interfaces. .Sh "Embedded Perl Syntax" Practically you can put any valid Perl constructs inside the ePerl blocks the used Perl 5 interpreter library can evaluate. But there are some important points you should always remember and never forget when using ePerl: .Ip "\fI1. Delimiters are always discarded.\fR" 4 Trivially to say, but should be mentioned at least once. The ePerl block delimiters are always discarded and are only necessary for ePerl to recognize the embedded Perl constructs. They are never passed to the final output. .Ip "\fI2. Generated content has to go to \f(CWSTDOUT\fR.\fR" 4 Although you can define subroutines, calculate some data, etc. inside ePerl blocks only data which is explicitly written to the \f(CWSTDOUT\fR filehandle is expanded. In other words: When an ePerl block does not generate content on \f(CWSTDOUT\fR, it is entirely replaced by an empty string in the final output. But when content is generated it is put at the point of the ePerl block in the final output. Usually contents is generated via pure \f(CWprint\fR constructs which implicitly use \f(CWSTDOUT\fR when no filehandle is given. .Ip "\fI3. Generated content on \f(CWSTDERR\fR always leads to an error.\fR" 4 Whenever content is generated on the \f(CWSTDERR\fR filehandle, ePerl displays an error (including the \s-1STDERR\s0 content). Use this to exit on errors while passing errors from ePerl blocks to the calling environment. .Ip "\fI4. Last semicolon.\fR" 4 Because of the following point 6 (see below) and the fact that most of the users don't have the internal ePerl block translations in mind, ePerl is smart about the last semicolon. Usually every ePerl block has to end with the semicolon of the last command. .Sp .Vb 1 \& <: cmd; ...; cmd; :> .Ve But when the last semicolon is missing it is automatically added by ePerl, i.e. .Sp .Vb 1 \& <: cmd; ...; cmd :> .Ve is also correct syntax. But sometimes it is necessary to force ePerl \fInot\fR to add the semicolon. Then you can add a ``\f(CW_\fR'\*(R' (underscore) as the last non-whitespace character in the block to force ePerl to leave the final semicolon. Use this for constructs like the following .Sp .Vb 5 \& <: if (...) { _:> \& foo \& <: } else { _:> \& bar \& <: } :> .Ve where you want to spread a Perl directive over more ePerl blocks. .Ip "\fI5. Shorthand for \f(CWprint\fR\-only blocks.\fR" 4 Because most of the time ePerl is used just to interpolate variables, e.g. .Sp .Vb 1 \& <: print $VARIABLE; :> .Ve it is useful to provide a shortcut for this kind of constructs. So ePerl provides a shortcut via the character \*(L'=\*(R'. When it immediately (no whitespaces allowed here) follows the begin delimiter of an ePerl block a \f(CWprint\fR statement is implicitly generated, i.e. the above block is equivalent to .Sp .Vb 1 \& <:=$VARIABLE:> .Ve Notice that the semicolon was also removed here, because it gets automatically added (see above). .Ip "\fI6. Special EndOfLine discard command for ePerl blocks.\fR" 4 ePerl provides a special discard command named ``\f(CW//\fR'\*(R' which discards all data up-to and including the following newline character when directly followed an end block delimiter. Usually when you write .Sp .Vb 3 \& foo \& <: $x = 1; :> \& quux .Ve the result is .Sp .Vb 3 \& foo \& \& quux .Ve because ePerl always preserves code around ePerl blocks, even just newlines. But when you write .Sp .Vb 3 \& foo \& <: $x = 1; :>// \& quux .Ve the result is .Sp .Vb 2 \& foo \& quux .Ve because the ``\f(CW//\fR'\*(R' deleted all stuff to the end of the line, \fIincluding\fR the newline. .Ip "\fI7. Restrictions in parsing.\fR" 4 Every program has its restrictions, ePerl too. Its handicap is that Perl is not only a rich language, it is a horrible one according to parsing its constructs. Perhaps you know the phrase ,,Only \fIperl\fR can parse \fIPerl\fR'\*(R'. Think about it. The implication of this is that ePerl never tries to parse the ePerl blocks itself. It entirely relies on the Perl interpreter library, because it is the only instance which can do this without errors. But the problem is that ePerl at least has to recognize the begin and end positions of those ePerl blocks. .Sp There are two ways: It can either look for the end delimiter while parsing but at least recognize quoted strings (where the end delimiter gets treated as pure data). Or it can just move forward to the next end delimiter and say that it have not occur inside Perl constructs. In ePerl 2.0 the second one was used, while in ePerl 2.1 the first one was taken because a lot of users wanted it this way while using bad end delimiters like ``\f(CW>\fR'\*(R'. But actually the author has again revised its opinion and decided to finally use the second approach which is used since ePerl 2.2 now. Because while the first one allows more trivial delimiters (which itself is not a really good idea), it fails when constructs like ``\f(CWm|"[^"]+"|\fR'\*(R' etc. are used inside ePerl blocks. And it is easier to escape end delimiters inside Perl constructs (for instance via backslashes in quoted strings) than rewrite complex Perl constructs to use even number of quotes. .Sp So, whenever your end delimiter also occurs inside Perl constructs you have to escape it in any way. .Ip "\fI8. \s-1HTML\s0 entity conversion.\fR" 4 Because one of ePerl's usage is as a server-side scripting-language for \s-1HTML\s0 pages, there is a common problem in conjunction with \s-1HTML\s0 editors. They cannot know ePerl blocks, so when you enter those blocks inside the editors they usually encode some characters with the corresponding \s-1HTML\s0 entities. The problem is that this encoding leads to invalid Perl code. ePerl provides the option \fB\-C\fR for decoding these entities which is automatically turned on in \s-1CGI\s0 modes. See description below under option \fB\-C\fR for more details. .Sh "Runtime Modes" ePerl can operate in three different runtime modes: .Ip "\fIStand-alone Unix filter mode\fR" 4 This is the default operation mode when used as a generation tool from the Unix shell or as a batch-processing tool from within other programs or scripts: .Sp .Vb 4 \& $ eperl [options] - < inputfile > outputfile \& $ eperl [options] inputfile > outputfile \& $ eperl [options] -o outputfile - < inputfile \& $ eperl [options] -o outputfile inputfile .Ve As you can see, ePerl can be used in any combination of \s-1STDIO\s0 and external files. Additionally there are two interesting variants of using this mode. First you can use ePerl in conjunction with the Unix \fIShebang\fR magic technique to implicitly select it as the interpreter for your script similar to the way you are used to with the plain Perl interpreter: .Sp .Vb 4 \& #!/path/to/eperl [options] \& foo \& <: print "bar"; :> \& quux .Ve Second, you can use ePerl in conjunction with the Bourne-Shell \fIHere Document\fR technique from within you shell scripts: .Sp .Vb 8 \& #!/bin/sh \& ... \& eperl [options] - <demo.table
Low-level HTML programming
Instead of writing down the complex HTML table constructs for the 1x1 chart we program it with the control structures of Perl language.
my $end = 12; # top bar print "
"; # side bar and content print"\n"; for (my $i=1; $i <= $end; $i++) { print " x "; for (my $i=1; $i <= $end; $i++) { print "$i "; } print "\n"; } !> $i "; for (my $j=1; $j<= $end; $j++) { print "", $i*$j, " "; } print"