Perl equivalent of PHP and JSP: Mason?


S

Steve Chapel

I've been contracted to make a website that requires a certain amount of
server-side programming. Specifically, users should be able to register
a username and password on the site. Associated with the username will
be contact information such as real name, email address, phone number,
etc. Once logged in, they should be able to register for an annual
meeting by paying with a credit card on the site.

I've worked on websites with PHP and JSP, and I would consider using
either of those languages. However, every time I write PHP I'm
frustrated that I can't write in Perl, which I'm much more familiar
with. And Java seems a tad verbose for doing the simple kinds of
programming that the site will need -- again, I'll probably wish I were
writing Perl.

I've been researching the Perl equivalent of PHP and JSP, and it seems
there are all too many alternatives: Perl Template Toolkit, embperl,
Mason, HTML::Template, Text::Template, and probably others. Some of
these alternatives seem to separate the Perl and HTML into two different
files. Others, such as the Template Toolkit, require learning an
additional language to do the templating. It seems like Mason is about
the closest equivalent to PHP and JSP for embedding Perl into HTML. The
Perl code is in the same file as the HTML and doesn't seem to require
learning large amounts of additional syntax. At least that's the
impression I get from the Mason book's comparison:
<http://www.masonbook.com/book/chapter-1.mhtml#TOC-ANCHOR-7>.

Am I right in concluding that Mason is what I will probably want to use
for this site as an alternative to PHP or JSP? Is it going to be just as
easy to use Mason to accept credit cards on the site as it would be to
use PHP? Will it be easy to find a web host that provides Mason support?
If the answer to these questions is "no," what language would you
recommend for the site?
 
Ad

Advertisements

J

Juha Laiho

Steve Chapel said:
I've been contracted to make a website that requires a certain amount of
server-side programming. Specifically, users should be able to register
a username and password on the site. [...]
I've been researching the Perl equivalent of PHP and JSP, and it seems
there are all too many alternatives: Perl Template Toolkit, embperl,
Mason, HTML::Template, Text::Template, and probably others. ....
Am I right in concluding that Mason is what I will probably want to use
for this site as an alternative to PHP or JSP?

I'd say HTML::Embperl is a fair comparision with PHP. On the surface,
Embperl doesn't list the number of libraries you get with PHP -- but
then, with Embperl you have more or less all the native perl libraries
at your perusal.

Neither (PHP or Embperl) brings in quite the same level of infrastructure
you get with JSP, but both should get the job done. Then, depending on
your needs and wants, you may not need even Embperl -- have you considered
creating HTML programmatically - as done in CGI.pm (in places where dynamic
page generation is needed), and just separate the rest off into static
html files?
 
M

Matt Garrish

Steve Chapel said:
It seems like Mason is about the closest equivalent to PHP and JSP for
embedding Perl into HTML.

PerlScript in an asp page is the closest equivalent to php I've encountered,
if you're just looking for similarity (or Apache::ASP, but I've never gone
that route). PerlScript can be a bit flaky, though, and don't expect
ActiveState to listen to your complaints.

As to what to use, only you can decide that. Look at what you know best, how
difficult you think this project is going to be, what makes more sense in
the long run for maintenance, and finally how quickly you want to get it off
your plate.

Matt
 
Ad

Advertisements

G

GClef

PerlScript in an asp page is the closest equivalent to php I've encountered,
if you're just looking for similarity (or Apache::ASP, but I've never gone
that route). PerlScript can be a bit flaky, though, and don't expect
ActiveState to listen to your complaints.

As to what to use, only you can decide that. Look at what you know best, how
difficult you think this project is going to be, what makes more sense in
the long run for maintenance, and finally how quickly you want to get it off
your plate.

Matt

I've used a CGI to generate web pages in the past but more recently have been
going the Apache::ASP route. The syntax for creating your HTML pages is very
similar to PHP (e.g. <%=$var%> -vs- <?=$var?>) and much the same flexibility for
editing pages.

GClef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top