Subject: | make_object() needs to copy its arguments |
The make_object() function uses an alias of its arguments (in the
@triples variable). Unfortunately, this can cause errors such as
"Modification of a read-only value attempted" at the call to serialise()
if the caller sends in any kind of reference (or something like that).
IMO this places undo burden on the caller to have to make sure all his
arrays are in just the right form. If you use the following code, it
works like a charm:
my $self = shift;
# Make a copy of our array-ref arguments,
# so we can modify them locally:
my @triples;
foreach my $ra (@_)
{
push @triples, [@$ra];
} # foreach