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
- serialize the parameters on the caller side, flattening out any references
- deserialize the parameters on the receiving side into the same prototype
- actual function executes with the deserialized parameters, potentially modifying the by reference parameters
- then serialize the modified parameters again to capture the modified values
- deserialize the parameters on the original caller side to update the parameter values
The problem happens on the last line which errors out with Modification of a read-only value. Why is this the case?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";
In Section
Seekers of Perl Wisdom