From: dpvc v. a. <we...@ma...> - 2005-06-05 23:10:33
|
Log Message: ----------- Fixed a bug with Matrix->perl() method that would cause an extra level of nesting in constant matrices. Modified Files: -------------- pg/lib: Value.pm Revision Data ------------- Index: Value.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -Llib/Value.pm -Llib/Value.pm -u -r1.35 -r1.36 --- lib/Value.pm +++ lib/Value.pm @@ -465,14 +465,16 @@ # sub perl { my $self = shift; my $parens = shift; my $matrix = shift; - my $class = $self->class; my $mtype = $class eq 'Matrix'; + my $class = $self->class; + my $mtype = $class eq 'Matrix'; $mtype = -1 if $mtype & !$matrix; my $perl; my @p = (); foreach my $x (@{$self->data}) { if (Value::isValue($x)) {push(@p,$x->perl(0,$mtype))} else {push(@p,$x)} } @p = ("'".$self->{open}."'",@p,"'".$self->{close}."'") if $class eq 'Interval'; if ($matrix) { - $perl = '['.join(',',@p).']'; + $perl = join(',',@p); + $perl = '['.$perl.']' if $mtype > 0; } else { $perl = $class.'('.join(',',@p).')'; $perl = '('.$perl.')' if $parens == 1; |