ASP-style tags for Perl web development?
I feel like I'm traveling 10 years back in time by asking this, but...
Are there any modules, patches, or any "new" version of Pe开发者_StackOverflow中文版rl (released in the last 10 years) to enable writing web-oriented Perl scripts using ASP-style tags?
e.g. from ASP/JSP
some html <% some code %> more HTML
e.g. from PHP
some html <? some code ?> more HTML
Please don't worry about "why" I'm asking this... It's related to programming language research.
Yep. Check out Mason.
You can install it from CPAN with cpan -i HTML::Mason
.
There's also Template Toolkit, which makes it a bit easier to separate your template and logic code, but allows a lot of the same constructs.
Markup::Perl
gets you pretty close to PHP/ASP style programming in Perl.
# don't write this...
print "Content-type: text/html;\n\n";
print "<html>\n<body>\n";
print "<p>\nYour \"lucky number\" is\n";
print "<i>", int rand 10, "</i>\n</p>\n";
print "</body>\n</html>\n";
# write this instead...
use Markup::Perl;
<html>
<body>
<p>
Your "lucky number" is
<i><perl> print int rand 10 </perl></i>
</p>
</body>
</html>
Embperl does support ASP style tags.
There's Apache::ASP and Apache2::ASP
精彩评论