version 1.4, 2012/02/04 15:12:40
|
version 1.5, 2012/02/10 00:13:35
|
Line 1
|
Line 1
|
<problem> |
<problem> |
|
<parameter name="externalurl" type="string" description="URL for external testing" /> |
<script type="loncapa/perl"> |
<script type="loncapa/perl"> |
sub fact { |
sub fact { |
my $n=shift; |
my $n=shift; |
Line 15 foreach $i (1..3) {
|
Line 16 foreach $i (1..3) {
|
$testvalues.=','.$rand.'='.&fact($rand); |
$testvalues.=','.$rand.'='.&fact($rand); |
} |
} |
|
|
|
# |
|
# Set anything else you want to pass in this hash. |
|
# Name-value pairs will be passed as posted form parameters. |
|
# |
%args=('somecode' => (<<'ENDCODE') |
%args=('somecode' => (<<'ENDCODE') |
sub negative { |
sub negative { |
my ($number)=@_; |
my ($number)=@_; |
Line 22 sub negative {
|
Line 27 sub negative {
|
} |
} |
ENDCODE |
ENDCODE |
); |
); |
|
# Get a URL if it is externally set |
|
$externalurl=¶meter_setting('externalurl'); |
|
# |
|
# Important: set your default URL here |
|
# |
|
unless ($externalurl=~/\w/) { $externalurl='http://localhost/cgi-bin/sampleexternal.pl'; } |
|
# |
</script> |
</script> |
|
|
|
|
Line 32 boolean function <tt>&negative(numbe
|
Line 42 boolean function <tt>&negative(numbe
|
<instructorcomment> |
<instructorcomment> |
Sample code for an evaluation script can be found <a href="/res/adm/includes/templates/sampleexternal.pl">here.</a></instructorcomment> |
Sample code for an evaluation script can be found <a href="/res/adm/includes/templates/sampleexternal.pl">here.</a></instructorcomment> |
<endouttext /> |
<endouttext /> |
<externalresponse url="http://localhost/cgi-bin/sampleexternal.pl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive."> |
<externalresponse url="$externalurl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive."> |
<textfield /> |
<textfield /> |
|
|
</externalresponse> |
</externalresponse> |