Sep 29, 2005, 4:11 AM
Post #3 of 3
After looking through the forums, I thought you might reply to this post, davorg
Re: [davorg] PTM Inline Perl/HTML Hybrid Language - Development assistance
[In reply to]
I completely agree. The Template Toolkit has worked fine for me in the past as well. However, it practically requires your average user to learn a new language all together and does not use straight Perl within its tags. Additionally it requires developers to look over a large amount of documentation before it can be used effectively.
Another commonly posed PTM alternative is InlinePerlPages (http://www.the-labs.com/InlinePerlPages/), which you also probably know of. It's functional, but somewhat akward in syntax at best.
The initial draw of PTM is the same as that of PHP. Simple code drop-ins where you want them with HTML-like tag syntax. To make life easier for PHP users I also decided, as of the first release, to implement basic-functionality ports of the _GET, _POST, and _SERVER variables from PHP.
Additionally, the $_URL, $_PATH, $_BASE, and $_SCRIPT vars come in handy for drawing up link structures quickly, and allow for portablility between servers, or just between directories without having to modify any of the script files. And, as the PPA (ptm.cgi) automatically adjusts its working directory to that of the requested script, all file handling operations are implemented from the calling directory so developers don't need to worry about the location of the actual script when loading files (important if installed directly to Apache, where the developers may not know the PPA's install path on host servers).
Next, assuming you've looked over the project page, you know that PTM is only at release version 0.3 Alpha. It is completely stable, and full Perl implementation is available to developers at this point. However, there are many more intended additions that simply haven't made it into the language yet. The next intended fix is to allow HTTP header modification, and after that I will begin wrapping the DBI-mysql module functionality to give PTM a similar ease of use with MySQL databases as PHP has, which is one of the contributing factors to its success to date.
Another advantage is that PTM is written entirely in Perl. One view on this could be that this may be slightly slower than a C implementation, for example. But this allows Perl developers to fully customize the language itself to suit their needs, on a per-project basis if necessary. They can add or remove tag types, redefine tag opening and closing characters (e.g. if you prefer [%, go for it), and create custom global variables. Because PTM is written in the very language it's implementing, it allows Perl developers to develop not only with the language, but on the language itself.
Of course your biased. ALL experienced developers are biased I started the PTM project because I too am biased -- but in a much more general sense. I am biased on the side of Perl over PHP and ASP. Why? because it's faster for what most of my clients require. However, Perl is not the right languge for all jobs, and I sometimes find myself using PHP instead. PTM allows for a relatively smooth conversion between the two languages, where as something like the Template Toolkit might as well be an alien language to your average PHP developer.
I think that's enough for now... but does it answer your question?
Michael L. Spencer
PTM Project Founder