A SERVICE OF

logo

Virtuoso 4.5 Application and Integration Reviewers Guide
Copyright ©2006 OpenLink Software
25
3.3.2.2 .NET Assemblies
3.3.2.3 Scripting Languages
When a page in PHP, PERL or Python is in an executable directory in the web server
space, no special code or declaration is required as in the aforementioned Java or CLR
examples. These languages will be executed when requested. There is however special
Virtuoso SQL specific functions for accessing these languages from stored procedures.
The following examples include PERL and Python code snippets followed by their SQL
invocation from Virtuoso Interactive SQL (ISQL).
3.3.2.3.1 Perl Example
In Figure 140, the example shows direct PERL code execution from Virtuoso PL.
Figure 33 - Executing PERL directly from Virtuoso PL
select __hosting_http_handler ('pl', 'print "hello, perl"; ', vector (), vector (), 't1.pl');
Figures 141 and 142 show Perl file execution from Virtuoso PL.
Figure 34 – PERL Code test_print.pl
#!/usr/bin/perl
print "hello, perl from a file";
Figure 35 - Virtuoso PL CODE
select __hosting_http_handler ('pl', 'test_print.pl');
3.3.2.3.2 Python Example:
In Figure143, the example shows direct python code execution from PL :
Figure 36 - Executing Python directly from Virtuoso PL
select __hosting_http_handler ('py', 'print "hello, python",; ', vector (), vector (), 't1.py');
Figures 144 and 145 demonstrate Python file execution from Virtuoso PL :
Figure 37 – Python Code test_print.py
#!/usr/bin/python
print "hello python from a file",;
Figure 38 – Virtuoso PL Code
select __hosting_http_handler ('py', 'test_print.py');