Pliant command line development

Running your first home written module

First, using your favorite text editor, create a /pliant/myorg/myapp/mymodule.pli file with:

console "hello word" eol

Then run it through typing at the operating system command prompt:

/pliant/binary/pliant-debug1.exe module /myorg/myapp/mymodule.pli

Please notice that Pliant executable contains an unusual .exe even under Linux.

If you are running Windows instead of Linux, the command will be:

\pliant\binary\pliant-debug1.exe module /myorg/myapp/mymodule.pli

Please notice that we use backslash for specifying the executable path because Windows makes it mandatory, but we use standard (outside Windows word) slashing in all Pliant code, including command line parameters. I have also omited the potencial C: at the head of the executable path because I'm assuming that you installed Pliant at the root of your default operating system disk unit.

Shortening the executable name

Under Linux, as root user, you may type in:

ln -s /pliant/binary/pliant-debug1.exe /bin/pliant

so that starting your program is now possible through the shorter command:

pliant module /myorg/myapp/mymodule.pli

In the remaining of the document, I will start all Pliant commands with just 'pliant' instead of /pliant/binary/pliant-debug1.exe or \pliant\binary\pliant-debug1.exe so that unless you are using Pliant under Linux and did create the just suggested shortcut, you will have to adapt the command according to your environment.

Precompiling

If your application get's long, Pliant dynamic compiling might become an issue because Pliant has a lot to compile on the fly so that testing your code becomes slow. This is where Pliant precompiling feature can help. If you type:

pliant module /myorg/myapp/mymodule.pli

It is in facts nearly the same as:

pliant 'precompile /binary/default.dump module /pliant/install/precompile.pli' module /myorg/myapp/mymodule.pli

If no such file exists, Pliant will create as a result a /pliant/binary/default-debug1.dump file that contains a dump of the process memory after compiling module precompile.pli so that on the next run the dump can be loaded and executation resume from that point with a lot of modules being already compiled.

So, assuming that your application contains two module mymodule1.pli and mymodule2.pli that are fairly long to compile and are used by mymodule3.pli that you are currently writing, then you could create a /pliant/myorg/myapp/precompile.pli module with the following content:

module "mymodule1.pli"
module "mymodule2.pli"

so that you can now repetively test mymodule3.pli through:

pliant 'precompile /binary/myapp.dump module /pliant/install/precompile.pli module /myorg/myapp/precompile.pli' module /myorg/myapp/mymodule3.pli

The drawback is that if you change something in mymodule1.pli or mymodule2.pli, then you have to remind to remove the /pliant/binary/myapp-debug1.dump file to get it automatically rebuilt from updated source code.

Please also notice that Pliant ability to precompile is still not perfect so that if your application unexpectedly crash, the first thing to do is to check if the crash also happens when the precompiling feature is not used.

Warning

You must not run two instances of Pliant at the same time if they share the same /pliant_security/ or /pliant_data/ directory.

If you want to run a second instance of Pliant, then you can create let's say a /second/ directory, then copy the /pliant/ directory to /second/pliant/ and finaly start the second Pliant instance through:

pliant root /second/ module /myorg/myapp/mymodule3.pli

The three directories used by this new Pliant instance are /second/pliant/ /second/pliant_data/ and /second/pliant_security/