Your checker needs to return a REFERENCE to an array, not an actual array. Try using
$mp = MultiPart($pfbypx_correct, $pfbypy_correct, $f_evalatx0y0_correct, $pfbypx_evalatx0y0_correct, $pfbypy_evalatx0y0_correct, $f_approxAtxy_correct)->with( singleResult => 0, checker => sub { my ($correct, $student, $self) = @_; my ($pfbypx_stud, $pfbypy_stud, $f_evalatx0y0_stud, $pfbypx_evalatx0y0_stud, $pfbypy_evalatx0y0_stud, $pfbypy_evalatx0y0_correct, $f_approxAtxy_correct) = @{$student}; my $scores = [1,1,1,1,1,1]; ... return $scores; }, );
You access the various scores as $scores->[0] , $scores->[1] and so on.
If you really want to use an array rather than an array reference, use
my @scores = (1,1,1,1,1,1); ... return ~~@scores;
which will return a reference to the array rather than the array
itself. (Note that ~~ is not standard Perl, for which it would be a
backslash, but because PG doubles all the backslashes in the file
before processing it, you need to use this instead. If you ever put
this into a .pl file rather than a .pg file, you'd need to use \@scores
not ~~@scores.)
Davide
<| Post or View Comments |>
|