Hello,
This is the first time that I write here.
I'm working on a Perl module to make a communication bridge between Perl and
R.
For now it's working very well, on Linux and Windows, but I'm making
some tests before release the 1st version.
One of the problems that I have is for invalid syntaxes for R, that crashes the
R interpreter.
Before explain the problem, I need to explain the architecture of the bridge:
The bridge can be used in 2 ways. Starting a R interpreter to be used just by
the Perl process it self, or is possible to start the R interpreter to be shared
between different process.
Here's an example of use from Perl of a shared bridge:
use Statistics::R ;
my $R = new Statistics::R() ;
$R->start_sharedR ;
$R->send('x = 2^10') ;
$R->send('print(x)') ;
my $return = $R->read ;
## This should print: value: [1] 1024
print "value: $return\n" ;
exit;
Soo, I can have different process using the same bridge, and the method
start_sharedR() only starts the R interpreter if it wasn't started yet.
The method send() write the commands to be sent to R in a input file (one for
each send()), that will be processed automatically by R.
To load this input files from R I use the command (in the R side):
source(PERLINPUTFILE)
But the problem is that if the source of the file that is loaded by R has some
error, the R interpreter crashes!
Here's an example of code that won't be loaded by R:
x = 1..100
The problem is the crash of the interpreter, since I really need to keep it
running even if it uses/loads some invalid syntax.
Soo, how can I load a file through source(), or any other way, and not crash on
invalid syntaxes?
Thanks in advance.
Regards,
Graciliano M. P.
[[alternative HTML version deleted]]