|Perl: the Markov chain saw|
Re: Dynamic Language questionsby mattr (Curate)
|on May 15, 2007 at 08:41 UTC||Need Help??|
Hi. The answers are yes to all the questions. A zipfile and demo site are available below. The zip is code for the admin portal which you cannot see but it is "real" code and satisfies a couple of your requests.
Based on my experience in a project I am delivering this week, and the recent YAPC::Asia conference, I'd say the state of the art is to use Catalyst. Though all the following elements can be used separately and combined with other modules in CGI too:
There are other frameworks too.. and you can roll your own. CGI::Application and CGI.pm was my friend until I left for Catalyst. I used HTML::Widget for forms for a little bit but switched to FormBuilder (at least until the H::W team finishes their new module). Some people like HTML::Template (which I used for a while before TT) or HTML::Mason for templates instead.
Wireframes, I've been doing for years with Perl. Used Visio for a while, now use OpenOffice. You can actually put HTML created through autoprototyping wireframe systems like Azure (or OpenOffice - save as HTML) into the catalyst templates folder and they will just work, but I prefer writing the HTML myself to keep it all clean and sane. Lets you incrementally add and test functionalisty. Wonderful!
I like Template::Toolkit for the way it lets you add code (their macro language as well as perl code though that is overkill - and I haven't used it but it ought to cover the Embperl case you mentioned) and you can just hand it a DBIx::Class resultset from a database search and you can then add object oriented tags to the templat for where you want fields to show up, looping around them for a list. (Try the search function in the demo below for example).
Web service, yes and it can even run on a separate server from your static content or serve static content if you want, you can write your own demons, use SOAP and other formats, etc.
I think the key is understanding that there is nothing stopping the language from doing any of these things, and it has a very strong public module repository with many of the hard things already done, polished, tested and integrated.
If you want a sample, point your browser to my beta site which is running right now. It includes creation of a customer portal for account management and automatic account creation based on signup form, plus automatic fulfillment by receiving Instant Payment Notifications from PayPal. If you want to use it as a demo to someone email me at telebody.net at mattr (backwards). This system is based on MySQL. I can give you a login if you want to see the customer portal, which includes a sales catalog with Buy Now buttons for advertising packages, or I can send a screenshot.
Also as demonstrated in a video on the YAPC ::Asia videos site, you can build a REST style interface to data and then easily render it out as HTML, JSON, XML, etc.
Catalyst has many, many modules used in it so it is easiest if you are root on linux. (not required though). And this is for a client so I can't give you a tarball. I can give you a copy of part of a screen rendering template and a formbuilder spec file. It's a pretty comprehensive site (like a mini-yahoo for Wisconsin cities) but willing to show you code for parts you need. The PayPal functionality for example might cover the Transaction topic you (Richard) mention.
Updated the zip file by adding the scripts folder and arranging Controller and View folders correctly (code is mainly in Admin.pm). It might even work if you run scripts/catmgr_server.pl and point your browser at localhost:3000/admin/admin_package_edit which would be a formbuilder form.