# -*- mode: perl -*- use HTML::Embperl ; my($r) = @_; $tst1 = '

Here is some text

' ; $r -> status (200) ; $r -> send_http_header () ; print "Test for HTML::Embperl::Execute\n" ; print "

1.) Include from memory

\n" ; HTML::Embperl::Execute ({input => \$tst1, mtime => 1, inputfile => 'blabla', req_rec => $r}) ; print "

2.) Include from memory with some Embperl code

\n" ; HTML::Embperl::Execute ({input => \'[- @ar = (a1, b2, c3) -]
[+$ar[$col]+]

', mtime => 1, inputfile => 'blabla2', req_rec => $r}) ; print "

3.) Include from memory with passing of variables

\n" ; $MyPackage::Interface::Var = 'Some Var' ; HTML::Embperl::Execute ({input => \'

Transfer some vars [+ $Var +] !

', inputfile => 'blabla3', mtime => 1, 'package' => 'MyPackage::Interface', req_rec => $r}) ; print "

4.) Change the variable, but not the code

\n" ; $MyPackage::Interface::Var = 'Do it again' ; # code is the same, so give the same mtime and inputfile to avoid recompile HTML::Embperl::Execute ({input => \'

Transfer some vars [+ $Var +] !

', inputfile => 'blabla3', mtime => 1, 'package' => 'MyPackage::Interface', req_rec => $r}) ; print "

5.) Inculde a file

\n" ; HTML::Embperl::Execute ({inputfile => '../inc.htm', req_rec => $r}) ; print "

6.) Inculde a file and return output in a scalar

\n" ; my $out ; HTML::Embperl::Execute ({inputfile => '../inc.htm', output => \$out, req_rec => $r}) ; print "

$out

\n" ; print "

7.) Done :-)

\n" ; print "\n";