Markup-Perl
view release on metacpan or search on metacpan
lib/Markup/Perl.pm view on Meta::CPAN
use Markup::Perl;
<body>
Today's date is <perl>src('inc/dateview.pml')</perl>
</body>
The included file can have the same mixture of literal text and <perl> tags allowed in the first file, and can even include other Markup::Perl files using its own C<src()> calls. Lexical C<my> variables defined in src files are independent of and ina...
=item print order
Not all output happens in a stream-like way, but rather there is an attempt to be slightly intelligent by reordering certain things, such as printing of HTTP headers (including cookies). Thus you can use the C<header()> call anywhere in your code, ev...
=back
=head1 FUNCTIONS
=over 3
=item header(name=>'value')
Adds the given name/value pair to the HTTP header. This can be called from anywhere in your Markup::Perl document.
=item param
Equivalent to CGI::param. Returns the GET or POST value with the given name.
=item cookie
Given a single string argument, returns the value of any cookie by that name, otherwise sets a cookie with the following values from @_: (name, value, expires, path, domain, secure).
=item src('filename')
Transforms the content of the given file to allow mixed literal text and executable <perl>...</perl> code, and evals that content.
=back
=head1 CAVEATS
For the sake of speed and simplicity, I've left some areas of the code less than bullet-proof. However, if you simply avoid the following bullets, this won't be a problem:
=over 3
=item starting out
Keep the C<use Markup::Perl> line simple. Its presence signals the beginning of new Markup::Perl syntax. The C<use> line should be on a single line by itself.
=item tags that aren't tags
The parser is brutally simple. It just looks for <perl> and </perl> tags, regardless of whether or not you meant them to be treated as tags or not. For example printing a literal </perl> tag requires special treatment. You must write it in such a way...
<perl>
<perl>
print '<'.'/perl>';
</perl>
=item including yourself
It is possible to include and run Markup::Perl code from other files using the C<src> function. This will lead to a recursive loop if a file included in such a way also includes a file which then includes itself. This is the same as using the Perl C<...
=item use utf8
I've made every effort to write code that is UTF-8 friendly. So much so that you are likely to experience more problems for B<not> using UTF-8. Saving your documents as UTF-8 (no BOM) is recommended; other settings may or may not work. Files included...
=back
=head1 COPYRIGHT
The author does not claim copyright on any part of this code; unless otherwise licensed, code in this work should be considered Public Domain.
=head1 AUTHORS
Michael Mathews <micmath@gmail.com>, inspired by !WAHa.06x36 <paracelsus@gmail.com>.
=cut
( run in 2.164 seconds using v1.01-cache-2.11-cpan-98e64b0badf )