| 1 |
# |
| 2 |
# Example for using Embperl::Execute |
| 3 |
# |
| 4 |
# run this under mod_perl / Apache::Registry |
| 5 |
# |
| 6 |
|
| 7 |
|
| 8 |
use Embperl ; |
| 9 |
|
| 10 |
my($r) = @_; |
| 11 |
|
| 12 |
# workaround for broken $r -> chdir_file in Apache::Registry on ActiveState perl |
| 13 |
use Cwd ; |
| 14 |
use File::Basename ; |
| 15 |
|
| 16 |
my $fn = $r -> filename ; |
| 17 |
chdir(dirname ($fn)) ; |
| 18 |
|
| 19 |
$Embperl::DebugDefault = 811005 ; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
$r -> status (200) ; |
| 24 |
$r -> send_http_header () ; |
| 25 |
|
| 26 |
print "<HTML><TITLE>Test for Embperl::Execute and errors</TITLE><BODY>\n" ; |
| 27 |
|
| 28 |
my $out ; |
| 29 |
|
| 30 |
print "<H1> 1.) The next one produces an error page</H1>\n" ; |
| 31 |
|
| 32 |
|
| 33 |
Embperl::Execute ({inputfile => '../error.htm', |
| 34 |
output => \$out, |
| 35 |
req_rec => $r}) ; |
| 36 |
|
| 37 |
|
| 38 |
print "<H3>$out</H3>\n" ; |
| 39 |
|
| 40 |
undef $out ; |
| 41 |
|
| 42 |
print "<H1> 2.) The next one produces an errors, but error page is disabled</H1>\n" ; |
| 43 |
|
| 44 |
|
| 45 |
Embperl::Execute ({inputfile => '../error.htm', |
| 46 |
output => \$out, |
| 47 |
options => Embperl::optDisableEmbperlErrorPage, |
| 48 |
req_rec => $r}) ; |
| 49 |
|
| 50 |
|
| 51 |
print "<H3>$out</H3>\n" ; |
| 52 |
|
| 53 |
undef $out ; |
| 54 |
|
| 55 |
print "<H1> 3.) Done :-)</H1>\n" ; |
| 56 |
|
| 57 |
|
| 58 |
print "</body></html>\n"; |