version 1.1, 2009/04/17 00:07:00
|
version 1.3, 2009/04/17 01:00:10
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# |
# |
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# Connect to MAXIMA CAS |
# Connect to R CAS |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 282 sub make_new_child {
|
Line 282 sub make_new_child {
|
while (my $cmd=<$client>) { |
while (my $cmd=<$client>) { |
&status('Processing command'); |
&status('Processing command'); |
print $command &unescape($cmd); |
print $command &unescape($cmd); |
my ($reply,$syntaxerr) = &getroutput($command,1); |
my ($reply,$syntaxerr) = &getroutput($command); |
print $client &escape($reply)."\n"; |
print $client &escape($reply)."\n"; |
if ($syntaxerr) { |
if ($syntaxerr) { |
last; |
last; |
Line 351 sub getroutput {
|
Line 351 sub getroutput {
|
my $realoutput=''; |
my $realoutput=''; |
foreach my $line (split(/\n/,$output)) { |
foreach my $line (split(/\n/,$output)) { |
$line=~s/\s$//gs; |
$line=~s/\s$//gs; |
|
if ($line=~/^Error\:/) { $syntaxerr=1; next; } |
if (my ($result)=($line=~/^\[\d+\,*\]\s*(.*)/)) { $realoutput.=$result."\n"; } |
if (my ($result)=($line=~/^\[\d+\,*\]\s*(.*)/)) { $realoutput.=$result."\n"; } |
} |
} |
if (wantarray) { |
if (wantarray) { |