Perl Runner



  1. Run Perl From Command Line
  2. Phprunner
  3. Php Runner Online
  4. Php Runner Registration Key
  5. Perl Script Runner
  6. Run Perl Online

Perl has been built with PERLOLDSIGNALS (see perl -V). The environment variable PERLSIGNALS is set to unsafe (see 'PERLSIGNALS' in perlrun). The module Perl::Unsafe::Signals is used. If unsafe signals is in effect, then signal handling is not thread-safe, and the -kill signalling method cannot be used. # Identity of objects returned from threads. Online GDB is online compiler and debugger for C/C. You can compile, run and debug code with gdb online. Using gcc/g as compiler and gdb as debugger. Currently C and C languages are supported. Perl TDD Runner. This is a tool that runs your Perl tests continuouslly when files change, helping you to TDD. Differently from provewatch, the provetdd holds all loaded modules in memory, and only reload what it needed, making it exponentially faster to run when testing a huge Perl codebase. Write and Run Your First Script. All you need to write Perl programs is a text editor. Notepad, TextEdit, Vi, Emacs, Textmate, Ultra Edit and many other text editors can handle the job.

A good setup for Perl on Windows (32 and 64 bit):

Perl Runner
  • Make sure you do not have any version of Perl already installed. (see video below for details), If you do uninstall it through the Window control panel 'add/remove programs', if you still have a C:Strawberry folder rename or delete it
  • Download and install Padre, the Perl IDE/editor (Strawberry Perl version 5.12.3 comes as part of the install, you also get many other useful CPAN modules as well).
  • Log out and back in (or reboot)
  • Go to your start menu, then click the 'Perl command' link
  • To confirm the installation worked type:
  • Install App-cpanminus by typing in:

Explanation of this setup

  • Padre, the Perl IDE is recommended, because you get Strawberry Perl (Perl packaged for Windows) 5.12.3 as well as many useful modules (especially those that are tricky to install) and the Perl IDE/editor itself.
  • To interact with the command line and run Perl commands, you need to run 'cmd'. There are better alternatives available as well.
  • App-cpanminus provides the cpanm tool, which makes installing Perl modules very simple to do.

I love Perl. It’s my first real language as a developer, and I’ve done very well with it over the past 19 years writing code much of those days. However, not all code can be open source and freely available. That’s why compiling perl scripts into binary files is a great way to share software without sharing the source code.

Why Compile Perl Scripts?

Perl is an interpreted and dynamic programming language. It has proven versatile throughout its long history. Through CPAN, there is still an active and thriving community of roughly 200,000 modules from over 13,000 authors. As a result, developers can create meaningful one liner scripts to full fledge applications and platforms with Perl.

However, running perl scripts requires the interpreter and appropriate modules on the system. Thankfully, most Linux distributions come with Perl. This certainly saves time setting up the environment. Then, users can run programs by sharing perl scripts and modules.

Yet, the source code for those scripts is visible to anyone. Developers sometimes don’t want to share how they write an application. The developer can decide to release the code as open source, or compile the source code to protect their intellectual property. Open source software is wonderful, but developers do like to eat. Unfortunately, free code doesn’t always exchange well for food and essential services. Although, there are certainly real world exceptions through a service model.

Another reason to compile source code is portability. It simplifies the requirements for the end user by providing a binary executable file instead of copying files to a system with the interpreter.

What Does Compiling Perl Scripts Mean?

Compiling allows developers to turn their source code into binary files. Unfortunately, it is possible to decompile executables and look at the original source. Thankfully, compiling does add a layer of defense. It is possible to further protect the source code depending on the features of the compiler.

In Perl, the file size for compiled binaries is much larger than the script’s file size. That’s because the scripts, any dependencies, and a copy of the perl interpreter are in the binary.

There are several options available for compiling perl scripts. However, many of them are abandoned projects or discontinued products. Regardless, it demonstrates historical interest to share perl scripts in binary form.

Which Compiler Should I Use?

Currently, I use ActiveState’s PDK on the Microsoft Windows and Linux platforms. Unfortunately, in 2017 ActiveState announced that it will no longer develop its Perl Development Kit. It works very well, and I would continue to use it if it wasn’t discontinued. Alternatively, Perl2Exe is also an excellent compiler for those whom require a commercial product or technical support.

On the other hand, PAR is free and actively maintained. The documentation can be overwhelming when digging in for the first time. Also, support is restricted to forums and user groups. Regardless, PAR has all the necessary features, the right price tag, a community, and it’s well maintained. Now, let’s take a deeper dive into PAR.

The Best Perl Program in the World

After months of development and weeks of QA testing, The Best Perl Program in the World is ready for release. However, this code is so brilliant and the environment so complex to deploy, that the program should be compiled before releasing it to the masses.

Before the world can benefit from this life changing experience, the perl script must be compiled within a Build Environment.

Compiling Perl in a Build Environment

A Build Environment contains the essential perl scripts, libraries, and perl modules necessary when compiling the binaries. Secondly, there will be a different Build Environment for each operating system and processor architecture. For example, a Microsoft Windows Build Environment is necessary for compiling Windows executables. However, those binaries will not work on a Linux system. Hence, a Linux Build Environment is necessary to compile Linux binaries. Yet, those x64 binaries will not work on ARM devices like a Raspberry Pi with the same Linux OS. Therefore, a Build Environment is necessary for compiling those perl scripts.

The setup is similar on various operating systems and processor architectures. Unfortunately, this can be expensive when using physical machines. Thankfully, using virtual machines on VMware, KVM, Hyper-V, openstack, or VirtualBox can save time and money. Virtual Machines are great for multiple Build Environments on a single system. Secondly, virtual machines have snapshot capabilities. Snapshots are helpful when experimenting with newer modules and configurations. If something goes wrong, it’s much faster to revert to a snapshot than to completely recreate a Build Environment.

A Microsoft Windows v10 Build Environment

Perl must be installed manually since it doesn’t come pre-installed on Microsoft Windows. Strawberry Perl is almost identical to a Perl installation on Linux systems. ActiveState ActivePerl is another alternative. Once one of those packages is installed, the next step is to install the modules PAR and PAR::Packer using cpan or cpanm. Any dependencies will install automatically.

Ubuntu 16.04 and 18.04 Build Environments

At the time of this writing, Ubuntu 18.04 just released as the latest (LTS) Long Term Supported version. Thankfully, both 16.04 and 18.04 use the same steps to install the necessary software packages. Between the two version, Ubuntu 16.04 has an older version of perl (5.22.1) and Ubuntu 18.04 has 5.26.1. Regardless, executing sudo apt install libpar-packer-perl installs the necessary libraries and modules.

A macOS 10.13 Build Environment

Like Ubuntu, different versions of macOS have different versions of Perl pre-installed. Unfortunately, Perl 5.18.2 is pre-installed with macOS 10.13. This version of perl is currently end-of-life. Although, fixes for urgent issues like severe security problems may still be released. Regardless, all packages for compiling perl scripts are already installed with the operating system. Nevertheless, a developer can upgrade to 5.26.1 if needed.

Other Operating Systems

As shown above, the steps to configure Build Environments are very similar. This means they could work with a little tinkering on other operating systems. Personally, I’m experimenting with Android since my Google Pixel XL is my PC. Also, Docker is showing promise as a portable Build Environment across different operating systems including binaries that can run on a Raspberry Pi.

Compiling Perl in a Build Environment

With the Build Environments ready, a developer can now build binaries. The pp command from the PAR Packager creates standalone executables from perl scripts. Remember The Best Perl Program in the World? The following demonstrates compiling perl on Microsoft Windows 10, Ubuntu 16.04, and macOS 10.13 using the pp command.

Php

The command line arguments are the same across the three different platforms. Most likely the arguments will be similar on any system that can install Perl and PAR Packer. However, there may be differences depending on the operating system, the program’s command line options, and processor architecture.

The pp command line

Phprunner download

The -M option adds modules and their dependencies. Furthermore, the more complex an application, the more modules are likely in use. For this reason, there are a few useful shortcuts to include multiple modules without having to list them separately.

  • -M Foo::** adds every module in the namespace except Foo. It will include Foo::Bar and Foo:Bar::More up to any depth except for Foo itself.
  • -M Foo::* adds every module in the first level. This include Foo::Bar and Foo::It but not Foo::Bar::More nor Foo.
  • -M Foo:: adds every module from Foo to any depth. This includes Foo, Foo::Bar, Foo::It, and Foo::Bar::More.

The -x option may not be necessary in some cases. However, it may find additional run-time dependencies which can’t be detected by static analysis. If the perl script uses arguments, use the xargs option to execute different code paths since detecting modules depends on which part of the code path runs. For more information, see the pp documentation.

The -o option is the name of the output binary file. It can be any name, and it doesn’t have to match the input file.

The last parameter, bestProgram.pl, is the input file. It is where pp starts the compiling process.

Securing the Source

Although the source is nicely compiled into a binary, it isn’t secure. Someone can still easily extract the source code from the executable files. That’s because the binary is a well-organized zip file right now.

Oh no! The source code for The Best Perl Program in the World is exposed! However, there are ways to protect the source code to a degree. Unfortunately, there is no bulletproof way to 100% protect source code. In fact, it’s not possible with any language. The best protection other than providing a comprehensive End User License Agreement, is to apply filters to the compile process.

Attempting to Secure the Source Code

PAR has the ability to apply filters to perl scripts and modules. However, the most common filter to hide source code from the casual eye is Bleach.

There are two additional command parameters relating to the Bleach filter. First, -f Bleach applies a filter to the input file, bestProgram.pl. Secondly, the -F Bleach option applies the filter to the perl modules. PAR provides flexibility to perform the filter on one or the other or both.

One caveat when compiling perl binaries is that it will increase the overall executable size. In some cases, it’s quite a bit. It will vary depending on the operating system and the number of modules passing through the filter during compile time. Below is an example of the size differences on Microsoft Windows 10.

Now when attempting to unzip the binary file after compiling perl to examine the source code, it looks hideous and unreadable. The same is true for the modules.

This is certainly a step in the right direction. Yet, this isn’t the only method when compiling perl scripts. There is another filter that encrypts the source code.

Making the Best Darn Attempt to Secure the Source Code

The compiler can encrypt files using the Crypto filter from the PAR::Filter::Crypto module. Like Bleach, the filter can take care of both the perl scripts and perl modules.

However, there are some important caveats concerning compiling perl scripts. Most noteworthy is both Bleach and Crypto filters will protect the source code from the causal curious user. Unfortunately, someone with more skills in hacking and debugging could obtain a copy of the source code.

Perl Runner

Regardless, there are additional modules to install in the Build Environment. Although, the version of Perl does matter. Unfortunately, the Filter::Crypto module does not successfully install on all versions of Perl.

Microsoft Windows

The only requirement when compiling perl using the Crypto filter is to install the Filter::Crypto module.

However, the version of Strawberry Perl matters. At the time of this writing, the latest version (5.26.2.1) fails to install the Filter::Crypto module. Although, Strawberry Perl 5.24.4.1 successfully installs it. If 5.26.2.1 is absolutely necessary, then the Bleach filter is the best alternative.

Run Perl From Command Line

Ubuntu 16.04

By default, essential libraries and header files aren’t available for the Filter::Crypto module. Therefore, the libssl-dev package is necessary to install first. The libssl-dev package is part of the OpenSSL project’s implementation of the SSL and TLS cryptographic protocols.

Lastly, install the Filter::Crypto module using cpan or cpanm.

Phprunner

Ubuntu 18.04

At the time of this writing, the version of Perl that is included with Ubuntu 18.04 (5.26.1) fails to install the Filter::Crypto module. Fortunately, a compiled encrypted binary from Ubuntu 16.04 will work on an Ubuntu 18.04 system. If Ubuntu 18.04 is absolutely necessary, either downgrade to a version of Perl that can successfully install the Filter::Crypto module or use the Bleach filter.

macOS 10.13

Although Perl 5.18.2 is available with this version of macOS, it can install the Filter::Crypto module. Furthermore, it is more manual and does involve answering some questions. During the process of installing the module, the location of OpenSSL is different than the default setting. However, the remaining questions use the defaults.

And Now the Magic

The pp command uses the Crypto filter like the Bleach filter. One other difference is the Filter::Crypto::Decrypt module must be packaged with the binary. Otherwise, the binary won’t know how to decrypt the files.

The file size of the binary is comparable to Bleach. However, both are still larger than the unprotected binary. Below is an example of the file sizes from an Ubuntu 16.04 Build Environment.

What would the casual curious user see when attempting to peel back the layers?

Distributing Binaries

Finally, The Best Perl Program in the World is ready to release. Not so fast!

Php Runner Online

There is one very important step before distributing binaries to the masses. In fact, it’s so important it should happen before any code is written using a perl module, library file, or SDK. If not, it could lead to legal issues. Yikes!

Usually, the license details are part of the package either in a LICENSE file, on a website, or in the documentation. However, there may be no license terms. Unfortunately, that doesn’t mean it’s ok to use it. In this case, it’s best to contact the author to either ask for permission or to clarify any licensing requirements.

Php Runner Registration Key

Generally, it comes down to the license and how the application uses it. There are a lot of open source licenses and each has different rules. Also, many libraries and SDK have their own terms and conditions. Furthermore, some may require purchasing a license to distribute. Unfortunately, licensing is a complex issue. Therefore, it may be necessary to speak with a lawyer.

For anyone that develops applications today, it’s likely that 3rd party libraries and modules are involved. Also, each of them requires careful examination of their use cases within an application. This can be a daunting task. Thankfully, there are companies out there that specialize in source code scanning to identify libraries, SDKs, and open source software licenses. However, it can be pricey depending on the size and scale of the application.

Perl Script Runner

Conclusion

Run Perl Online

Interpreted Languages like Perl require the interpreter and other modules on the system to run the program. Thankfully, there are options available for compiling perl scripts into binaries.

PAR is an excellent cross-platform package that can accomplish this goal. Additionally, PAR Filters make it easy to obscure source code and modules. However, it is important to comply with the licenses and terms of use for any third party component before releasing any software.