Log Message:
-----------
Make List("1,2,3") work like List("1","2","3") rather than produce a
list with one element that is a list.
Modified Files:
--------------
pg/lib/Value:
List.pm
Revision Data
-------------
Index: List.pm
===================================================================
RCS file: /webwork/cvs/system/pg/lib/Value/List.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -Llib/Value/List.pm -Llib/Value/List.pm -u -r1.15 -r1.16
--- lib/Value/List.pm
+++ lib/Value/List.pm
@@ -25,6 +25,7 @@
sub new {
my $self = shift; my $class = ref($self) || $self;
my $p = shift; my $isFormula = 0;
+ my $isSingleton = (scalar(@_) == 0 && !(Value::isValue($p) && $p->class eq 'List'));
$p = $p->data if (Value::isValue($p) && $p->class eq 'List' && scalar(@_) == 0);
$p = [$p,@_] if (ref($p) ne 'ARRAY' || scalar(@_) > 0);
my $type;
@@ -36,6 +37,7 @@
else {$type = 'unknown' unless $type eq $x->type}
} else {$type = 'unknown'}
}
+ return $p->[0] if ($isSingleton && $type eq 'List' && !$p->[0]{open});
return $self->formula($p) if $isFormula;
bless {data => $p, type => $type}, $class;
}
|