Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Dynamic Language questions

by mattr (Curate)
on May 15, 2007 at 08:41 UTC ( [id://615491]=note: print w/replies, xml ) Need Help??


in reply to Dynamic Language questions

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:

Oh and some people like a different framework, Jifty which I don't know well enough to mention. However the "What's Cool About Jifty" part of its docs suggest it might even be easier than Catalyst to use! Hmmmm. It has form based dispatch so you don't have to write your own forms. In FormBuilder you write a spec for the form and how each field is validate in a configuration file and then write your backend code. I wonder if Jifty is even easier..?

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.

I've assembled part of a catalyst system based on subroutines from my production code, here (zipfile). It won't run as-is since there is no database behind it, but it includes all the files and subroutines I think to run the "list customers" and "edit a package" functions in the admin portal of a real site. It doesn't include the PayPal code though I can supply if you require it. It does include templates (satisfying the wireframe request) using templates with embedded macro code broken into subtemplates, and a submission form based on FormBuilder with a separate spec file. There is no need to write html for the form and FormBuilder handles validation both in Perl as well as in Javascript (displaying an error on invalid input). I will be removing the zip file after a while so if you need it please take a copy and tell me if you do. Thanks.

Matt

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://615491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-19 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found