Dr Wisenheimer's lightweight edition:
#!/usr/bin/env perl use strict; use warnings; use feature qw(say); use MCE::Shared; package MyClass { use Class::Tiny { foo => q(bar) }; }; my $object = MCE::Shared->share( { module => 'MyClass' } ); say q(Before forking: ) . $object->foo; my $pid = fork; if ( $pid == 0 ) { $object->foo(q(baz)); exit; } else { waitpid $pid, 0; } say q(After forking: ) . $object->foo; __END__
I don't know if this helps. At least it is funny.
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help
In reply to Re: Modifying an object in a fork
by karlgoethebier
in thread Modifying an object in a fork
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |