Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: IPC::Sharable ... curious ipcs -a results

by stevieb (Canon)
on May 27, 2021 at 20:32 UTC ( [id://11133168]=note: print w/replies, xml ) Need Help??


in reply to Re: IPC::Sharable ... curious ipcs -a results
in thread IPC::Sharable ... curious ipcs -a results

For example, perhaps it might be better to convert the hash to a string (using Data::Dumper) and it is the string that is stored in the shared-memory segment.

Personally, I use JSON to store my data. I like the ease of it, and its especially good because it's cross platform and stores well in files if you want to dump the data for future program runs. Here's a non-complete example:

use warnings; use strict; use JSON; my $shared_memory_variable = ...; # Create shared mem with IPC::Sharea +ble my $data = { a => 1, b => [ 1, 2, 3 ], c => { z => 99, y => 98, x => { m => 'hello, world!' }, }, }; # Create JSON string and store it in the shared memory allocation $shared_memory_variable = encode_json $data; # Restore the shared memory JSON to a Perl data structure my $perl = decode_json $shared_memory_variable;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found