![]() |
|
This subtitle is about PET, a Perl application server and RAD environment for web programming. It is similar in many concepts to Tomcat for Java, Rails for Ruby or Zope for Python. There is also a resemblance with Apache::ASP or Catalyst.
PET uses the excellent TT2 as its templating engine, and is built upon a few gazillion CPAN modules. It can be run in different ways, but in production, it is usually run as a daemon, and must be coupled with a webserver that has FastCGI connectivity.
Currently PET only supports Linux. Please see some incomplete and outdated docs for more info.
I am going to include some actual trick and examples here, the purpose being to show what you can achieve using PET.
A very typical web programming task is to take a directory which contains a bunch of images, and create a thumbnail gallery out of it. The Album module does this very professionally, and an actual industry - TGP sites - is built around this idea.
In theory, it is relatively easy to create an album. All you have to do is to list the directory, get the images, resize them and then display the thumbnails on a (HTML) page with links to the original images. So let's make this easey in practice, too!
Using a few PET built-ins, I am going to show you how to create an album without writing any Perl code - using only 6 lines of code. We will have a page list.pet which lists the thumbnails, and another one called show.pet, which shows the big (original) image.
| 1. |
PET tricks
2007, November 17., 0h |
| 2. |
Creating a TGP-like gallery using PET in 6 lines
2007, November 17., 0h |
| Title: | Bent Over |
| Visited: | 0 |
| Uploaded at: |