Perl Basics   «Prev  Next»

Lesson 6Cross-platform
ObjectiveLearn about Perl's evolution from Unix-only to cross-platform availability.

Cross Platform Perl Programming

Perl was originally written for Unix, and some of its features are specific to that operating system. In this course we will do our best to avoid those features or at least draw attention to the places where they are necessary. But Perl is not tied to Unix. Currently there are precompiled Perl distributions available for most common platforms, including the big three: Unix, Macintosh, and Windows.
Is Perl a cross platform programming language?
Answer: Yes, Perl is a cross-platform programming language, which means that Perl code can run on multiple operating systems such as Windows, macOS, and Linux, without any modifications. This makes it an attractive choice for developers who need to write code that can run on a variety of systems, as well as for system administrators who need to write scripts that can be run on different types of servers.

Support for the Tk interface

  1. Support for the Tk interface to Perl became available for the Win32 port. Tk is a GUI widget toolkit that comes from the UNIX world, where it was the Delphi-like rapid application development tool for the X Window system. If you think it is hard to program graphics in Windows, X is worse than you could ever imagine. Before Tk, no real alternative to low-level C code existed for GUI development. Tk is of interest both to transplanted UNIX developers, who already know it, and to people who want to create cross-platform GUIs. The material on developing GUIs using Automation servers is still of interest to Windows programmers, however, because Tk is likely going to have a learning curve, and Visual C++ is likely already to be well known.
  2. Although I do not discuss XS in this course, and I say XS is harder to learn from scratch, do not get the idea that I am knocking it. I am constrained by time and space to talk about things that have not been talked about elsewhere. The XS interface is finally becoming fairly well documented, and if you need to learn it, you can pick it up. XS is a viable alternative and may be the best alternative in many instances, especially if you have C code you want to compile and embed in Perl on many different platforms. XS is actually an inteface (somewhat similar to IDL) for defining the "glue" between a Perl module and an extension library. You need to learn this extension language and write all the glue code yourself. With Automation, Perl’s Win32::OLE module has prewritten glue for the Perl side, and Visual C++ automates generation of the glue on the C++ side. For the programmer who wants to knock out code fast, Automation requires less work.
  3. If you would like more information, be sure to get a good course (see Bibliography) that discusses how COM specifically works with the registry, not just how to tweak user interface settings in the registry.
  4. If you don’t know what a GUUID, it is not important. See an advanced course such as Box’s Essential COM for details. This discussion is for the enlightenment of COM programmers getting into Perl.
  5. One of the remaining problems with object-oriented programming in general is that different people still call the same idea by different names, which makes writing a course that uses mixed languages difficult.
  6. I am reminded of a mainframe programmer who was told the 6 byte restriction on symbols in the assembler had been relaxed in a new version.
  7. By this qualification I mean that UNIX, and all OSes after it (Windows, OS/2, etc.), have used C as their systems programming language. All interfaces are defined in terms of C, and all other languages tend to go along with it because they have to. Now, with C++, this is not the case. All systems programming interfaces are either still defined in C, or, for Windows at least, are being redefined in terms of COM.

Cross Platform - Quiz

Click the link below to take a quiz with respect to the cross platform features of Perl.
Cross Platform - Quiz
A current listing of available platforms is available on the Perl.Com Web site.