Lasso Soft Inc. > Home

  • Articles

Including output generated from other languages in Lasso 9

Instead of reinventing the wheel, it is sometimes preferable to leverage scripts from other languages such as php, perl, python or ruby. This article describes how to execute scripts from these common programming language choices in Lasso 9. The code may then be incorporated procedurally within your logic, or abstracted into a method.

The code

* “mode” is the language type, “content” is the external script or file to be executed

	thisroot = 'cd "'+file_forceRoot()+'";',
	pre = " "
match(#mode) => {
		#pre = "php -r "
		#pre = "python "
		#pre = " "
		#pre = " ./"
		#pre = "perl "
		#pre = "ruby "

shell(#thisroot + #pre + "'" + string(#content) + "'")

How it works

The local variable #thisroot forces the command line access to be executed relative to the file being invoked.

Each language type may have specific options for invoking via command line, for instance PHP and an executable bash script file. These options are set using the match process.

The shell method is used here to simplify the execution and output handling of the os_process method.

Note: the script is executed by default with the current Lasso 9 user permissions.

Author: Jonathan Guthrie
Created: 3 May 2011
Last Modified: 3 May 2011


No comments found
You must be logged in to comment.

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft