[LON-CAPA-cvs] cvs: loncom /homework lonr.pm
raeburn
raeburn at source.lon-capa.org
Wed Nov 19 16:14:47 EST 2014
raeburn Wed Nov 19 21:14:47 2014 EDT
Modified files:
/loncom/homework lonr.pm
Log:
- Need to handle 'N;' in serialized data from phpSerialize(), because
phpSerialize.r adds it to the string when a null value is encountered.
Index: loncom/homework/lonr.pm
diff -u loncom/homework/lonr.pm:1.10 loncom/homework/lonr.pm:1.11
--- loncom/homework/lonr.pm:1.10 Wed Sep 2 14:13:16 2009
+++ loncom/homework/lonr.pm Wed Nov 19 21:14:47 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Interface routines to R CAS
#
-# $Id: lonr.pm,v 1.10 2009/09/02 14:13:16 www Exp $
+# $Id: lonr.pm,v 1.11 2014/11/19 21:14:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,9 @@
#
sub Rpeel {
my $x = $_[0]; # the string containing the serialized R object(s)
- if ($x =~ /^((?:i|d):(.+?);)(.*)$/) {
+ if ($x =~ /^N\;(.*)$/) {
+ return ('',$1);
+ } elsif ($x =~ /^((?:i|d):(.+?);)(.*)$/) {
return ($1, $+); # x starts with a number
} elsif ($x =~ /^s:(\d+):/) {
my $n = $1; # x starts with a string of length n
@@ -147,6 +149,8 @@
}
if ($errormsg) { return $errormsg; }
return \%h; # return a reference to the hash
+ } elsif ($x eq '') {
+ return '';
} else {
return 'Unrecognized output';
}
More information about the LON-CAPA-cvs
mailing list