Just another Perl shrine | |
PerlMonks |
Re: Argument for Perl ( again and again )by afoken (Chancellor) |
on Oct 19, 2012 at 18:04 UTC ( [id://1000005]=note: print w/replies, xml ) | Need Help?? |
I think the main question is: Does the language get the job done? The last six months, I've reworked a 30 years old legacy system written in MUMPS to use some state-of-the-art hardware. Low-level drivers for the hardware were delivered as DLLs written in C, High-level drivers came wrapped as Java classes, using JNI and Python wrapped in Java. High-level communication uses hexdumps wrapped in XML. My first attempt was to use the low-level interface and a MUMPS-C-Interface, but that failed because the low-level interface is essentially unuseable. So I tried to embed Java inside the MUMPS process, that failed because of at least two different C runtimes fighting out who owns the processs and who can create threads. Instant crash. The final solution is a TCP server written in Java that communicates with the high-level drivers and translates XML and hexdumps into something that can easily be parsed by MUMPS. The MUMPS process communicates via TCP/IP with the Java TCP server. Missing details: A custom C program loads the Java runtime. A big Makefile written for both dmake and GNU make builds everything. Perl to generate some code and the documentation for the MUMPS code, and to test both Java and MUMPS code. Perl also converts legacy data written out by MUMPS as CSV into a new format, generating executable MUMPS code to reconstruct the data in the new format. InnoSetup builds a nice setup.exe, using Pascal for scripting during the setup. And a second Java program, also started via a custom C program, that connects MUMPS to an an external SFTP (SSH) server. So, what's the "best" language? I used to say (or even shout) "Perl, because of CPAN, and because it stays out of my way". That's still true for many problems, but in this case, Java was "better" because of the 3rd party high level drivers written in Java. Interfacing those drivers from anything else than Java would have added even more layers of wrappers, making the solution even more complex than it is now. I've learned that it can be very helpful to have more than one tool in your toolbox. I use Perl, and I prefer it for many problems, but I have no problem to use C, Java, Javascript, Bash, Pascal, MUMPS, assembler or a Makefile if that solves the problem easier or cleaner than Perl. And when it comes to adapting things that were never designed to fit together, I combine my tools, as shown above. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|