Her indoors wants an e-commerce web site to sell table mats <link posted + discount to journal readers when available >. Despite enthusing about Perl and using it daily, I actually prefer to write dynamic websites in PHP <hiss boo>. Its quick, simple, very easy to prototype, and if an ISP is offering PHP then you know your site will work, rather than having to negotiate module installation and/or maintaining your own mini-CPAN in your user directory.
Most of the donkey work going on behind the scenes in an e-commerce site is simply writing and retrieving data from a database, and adding things together once in a while. My object model might require a dozen classes, although the attributes of each class are very different, the methods are very similar.
So to automate the creation of my PHP I've reduced the various classes to a simple XML template. This template is parsed by a Perl script which not only spits out a fully formed PHP class from the template but also writes the common 'store', 'retrieve', 'retrieveLike' methods too. All thats left is for me to write the unique methods for the classes, about 3 or 4 per class. I dont have to worry about the simple methods, since I know they'll work (sure I'm going to test anyway), any errors I made in the template will tend to be very obvious since the class wont look like the object model or wont interface with the database. Now I have a templating system to help me rapidly create new PHP classes when I need them.
Cool or what !
Re:are you willing to share your perl code?
MGLEE on 2003-10-09T12:49:23
No problem. Its not really suitable for CPAN as its very much a personal tool, but once I'm sure its working as I intended, I shall release it.Re:are you willing to share your perl code?
huberfelix on 2003-10-10T13:00:37
cool thanks!