http://qs321.pair.com?node_id=1071953


in reply to Re^6: Executing functions from another process
in thread Executing functions from another process

The subroutines that I am trying to call from one process to the other do indeed pass a bunch of data, some of which is by reference. I understand that this can't be done due to the memory space separation of the two processes. I also understand that I would need to
  1. serialize the parameters on the caller side, flattening out any references
  2. deserialize the parameters on the receiving side into the same prototype
  3. actual function executes with the deserialized parameters, potentially modifying the by reference parameters
  4. then serialize the modified parameters again to capture the modified values
  5. deserialize the parameters on the original caller side to update the parameter values
I've put together a very simple example of the first 3 steps where I use Data::Dump for my (de)serialization. However, I am running into an issue.
use warnings; use strict; use Data::Dump qw(dump); my $a = "one"; my $b = "two"; my $c = \$b; my @d = ($a, $b, $c); my $str = dump(@d); # ("one", "two", \"two") my @newD = eval $str; $newD[0] = "A"; $newD[1] = "B"; ${$newD[2]} = "C";
The problem happens on the last line which errors out with Modification of a read-only value. Why is this the case?