Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

On Sharing perl data structures

by arc_of_descent (Hermit)
on Sep 08, 2004 at 20:32 UTC ( [id://389458]=perlquestion: print w/replies, xml ) Need Help??

arc_of_descent has asked for the wisdom of the Perl Monks concerning the following question:

Greetings to all.

I was just wondering whether there is any perl module out there which would enable a perl process to share its data structures to other perl processes which might need it?

This is how I would like to use it:

In script whose data structures I want to share

use Sharable; # %contracts is one data structure I would like to give away my %contracts = ( 'VLAN1' => 45, 'VLAN2' => 46, 'VLAN3' => 78, ); Sharable::give_away(%contracts);

In script where I would like data from elsewhere

use Sharable; # $pid is PID of process which is sharing data my $received_stuff = Sharable::get_data($pid); # $received_stuff will be similar to %contracts

I hope i've made myself clear. In short I'm talking about a IPC mechanism to share perl data structures. A very high level one, with a maximum of 3 method/subroutine calls in each process to get stuff done.

So. huh. is there..?

I would dearly like to get one suited to my taste, which I guess I can tailor it myself once I get some framework modules.

Thanks for reading.

Replies are listed 'Best First'.
Re: On Sharing perl data structures
by hardburn (Abbot) on Sep 08, 2004 at 20:42 UTC

    There are various IPC mechanisms in Perl. See perlipc.

    What it looks like you want is a way to serialize the data structure, save it to a file, and get it from another program later on. There are a few CPAN modules for that. Storable.pm seems to be the most popular.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Re: On Sharing perl data structures
by BUU (Prior) on Sep 08, 2004 at 23:39 UTC
Re: On Sharing perl data structures
by valdez (Monsignor) on Sep 08, 2004 at 22:43 UTC

    If you need to share data between different machines, you could use memcached:

    memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
    See Cache::Memcached for more details.

    Ciao, Valerio

Log In?
Username:
Password:

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

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

    No recent polls found