HTML::EmbeddedPerl - The Perl embeddings for HTML.
recommends run on automatic.
passing of instanced object $epl. that are reference of Apache::RequestRec(modperl) or __PACKAGE__(cgi). example of use in the code tags.
# output header ($key,$value) $epl->header_out('Content-Type','text/html'); # set of contents type, default is 'text/html', output forcing. $epl->content_type('text/html');
$htm = something; use HTML::EmbeddedPerl; $e = HTML::EmbeddedPerl->new(); # output header ($key,$value) $e->header_out('Content-Create','foo'); # set of contents type, default is 'text/html' $e->content_type('text/plain'); # flushing header and contents. (example 1) $e->ep(\$htm); # not flushing header, return contents to $r. $r = $e->ep(\$htm); # flushing HTTP header. $e->flush; # same above. (example 1) print $r;
The Perl-Code embeddings for HTML, it is simple and easy.
adding <$ Perl-Code $> to your HTML. if code blocks too many, cannot use local variables between code blocks.
if you want not use of global variables, please use $var. destruct $var after execute. but it can use between multiple tags too.
<FilesMatch ".*\.phtml?$"> SetHandler perl-script PerlResponseHandler HTML::EmbeddedPerl PerlOptions +ParseHeaders </FilesMatch>
may be had compatible PerlResponceHandler modperl.
inserting first line to
#!/your/path/twepl
if you cannot use twepl? but wrapper.pl is available.
AddType application/x-embedded-perl .phtml AddHandler application/x-embedded-perl .phtml Action application/x-embedded-perl /your/path/wrapper
force exiting over the timeout for loop detection. $TIMEOUT is global, please change it overwritten.
# default is "2" seconds. $TIMEOUT = 2;
already executing under alarm, cannot change that timeout.
# set as new timeout. alarm($TIMEOUT); # cancelling timeout. alarm(0);
$TIMEOUT = X; # cancelling timeout and unset timeout. alarm(($TIMEOUT=0));
# set as new timeout. alarm(X);
before calling sub ep()
$HTML::EmbeddedPerl::TIMEOUT = X;
it simply solving cgi-modperl compatibility.
for cgi interface. other Subs define it freely.
header_out content_type print flush
for modperl, run in the depends Apache::RequestRec and more.
$TIMEOUT(global) $epl $var
Twinkle Computing <twinkle@cpan.org>
Copyright (c) 2010 Twinkle Computing All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::EmbeddedPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::EmbeddedPerl
CPAN shell
perl -MCPAN -e shell install HTML::EmbeddedPerl
For more information on module installation, please visit the detailed CPAN module installation guide.