[LON-CAPA-dev] Extracting problems from page or sequence
H. K. Ng
lon-capa-dev@mail.lon-capa.org
Thu, 27 Feb 2003 14:42:22 -0500
Two problems.
1. my $parts = $curRes->parts();
does not return anything?
2. I used the function below but it returns a null string.
(&Apache::loncommon::get_student_answers($symb,$uname,$udom,$ENV{'request.course.id'}
gave the right answer so I know the arguments are ok.)
my $subresult=&Apache::lonnet::ssi($request->uri,
('grade_target' => 'analyze'),
('grade_domain' => $domain),
('grade_user' => $user),
('grade_symb' => $symb),
('grade_courseid' => $courseid));
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
my %analyze=&Apache::lonnet::str2hash($subresult);
And %analyze is a hash containg the structure of the problem.
Looking at lonnet,
sub ssi {
my ($fn,%form)=@_;
my $ua=new LWP::UserAgent;
my $request;
if (%form) {
$request=new HTTP::Request('POST',"http://".$ENV{'HTTP_HOST'}.$fn);
$request->content(join('&',map { &escape($_).'='.&escape($form{$_})
} keys %form));
} else {
$request=new HTTP::Request('GET',"http://".$ENV{'HTTP_HOST'}.$fn);
}
$request->header(Cookie => $ENV{'HTTP_COOKIE'});
my $response=$ua->request($request);
return $response->content;
}
Is this the latest version. I just updated lonnet this morning.
Thanks, hk