Aaah, Perlscript
I'm doing some ASP based work, and I've been doing all the new code on the
site using Activestate's Perlscript. There've been a few hiccups, where
built in ASP functionality hasn't worked quite the same way, but overall
I've been very happy with it.
Using Perlscript as opposed to VBScript, it's a heck of a lot easier to
well factored pages that use business objects (.pm files) that have xcopy
deployment, implement MVC using the aforementioned business objects and the
excellent Template Toolkit, and you get a host of excellent web page
generation widgets in the expansive CGI.pm. Database interaction is a
breeze using DBI and it's built-in utility functions, compared to the
clunky Field("").Value calls and horrendous concatenation functionality of
VBScript. In each of the examples above, many lines of VBScript or VB.NET
collapse into a concise perl idiom.
Some of the reports have been business intelligence-type stuff, where you
have a multi-level information hierarchy (Customer->Dollars->Product->Day
being a typical one.) The code to produce nested data structures in Perl is
too easy in the sense that it's easy to make mistakes and reference
something incorrectly. But there's an incredibly smaller amount of code to
do the same type of work wrt VB and it's ilk, and once the data structure
has been set up, knocking out the report XHTML is a breeze with Template
Toolkit (which hides the bulk of the awkward perl/object syntax.)
In addition, using Win32::ASP, the actual amount of ASP code in the pages
becomes quite small, making a port to Apache or even Perl.NET a
straightforward endeavor. This also allows me to prototype and run the more
complicated scripts in Perl from the command line, using the step-debugger
if necessary. And I get to do this without ponying up the big bucks to
become dependent on an IDEsolution like Visual Studio.NET, which often
wedges IIS, forgets version control settings, and pretty much brings any
machine older than 1.5 years to a standstill with memory and CPU
requirements.
(VS|ASP|VB).NET offer some amount of catch-up on the features above, but I
find they still lag pretty far the code I can easily generate myself with
free tools in terms of learning curve (pod vs. 10Gigs of compiled html
help - ugh), time-to-market, maintainability, testability and ease of
customization.
I'll admit, there are times when it's good to use a typed language like
what you get with .NET ( it's helpful in the business objects, for
instance ) And I've looked into the many ways to add this back in to Perl,
but there are so many options, none of which seems to have much mindshare
( perl and typing mix like oil and water ), that I haven't really got
beyond the judicious use of Carp::Assert assertions to make my code more
bulletproof. I'd like to add in some more design-by-contract functionality
and have named/required and/or typed arguments to some subroutines ( I'm
mostly stealing these ideas from OpenACS ). But for now, I'm
appreciating the ease in overloading inherent in being free of type
restrictions.
5:50:05 PM
|
|