Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Best way to store an object collection.

by jeteve (Pilgrim)
on Aug 04, 2005 at 09:23 UTC ( #480737=perlquestion: print w/ replies, xml ) Need Help??
jeteve has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks. Here is my quest:

I wish to store a collection of heterogeneous objects under a key name in order to make them persistent. I don't need to query them, I just need to be able to give the key and retrieve the collection. I also like to use a RDMS server as storage backend.

I had a look to *Session* ( like CGI::Session ) or *Cache* (like Cache::FileCache ) but theses storage are dedicated to store temporaly objects so they don't really fit my needs since object destiny is to expire within those storages.

I also had a look at data serializers like Data::Serializer, but it don't seem able to use a database as storage backend.

What would you do you wise monks to cope with that issue ?
Thx !
Nice photos of naked perl sources here !

Comment on Best way to store an object collection.
Replies are listed 'Best First'.
Re: Best way to store an object collection.
by davorg (Chancellor) on Aug 04, 2005 at 09:33 UTC
      Wooow, it rocks :)
      Nice photos of naked perl sources here !
Re: Best way to store an object collection.
by knoebi (Friar) on Aug 04, 2005 at 09:43 UTC
Re: Best way to store an object collection.
by SimonClinch (Chaplain) on Aug 04, 2005 at 09:34 UTC
    perltie seems appropriate - although the documentation foucuses on tying hashes, scalars and array, don't let this fool you - tie is just as good at tying objects to database entries.

    One world, one people

Re: Best way to store an object collection.
by srdst13 (Pilgrim) on Aug 04, 2005 at 13:54 UTC

    You may want to look at Tie::DBI. If you have a complex data structure associated with each key (a complex hash of hashes, or the like), you can use Storable, Data::Dumper, or YAML to serialize the data structure to text and store that.

    For a more database-centric view of things, look at Class::DBI.

    Sean

Re: Best way to store an object collection.
by InfiniteLoop (Hermit) on Aug 04, 2005 at 20:59 UTC
      And how does that make the objects persistent?

      /J

Re: Best way to store an object collection.
by kwaping (Priest) on Aug 04, 2005 at 23:21 UTC
    Are you talking about storing in RAM or in a file?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://480737]
Approved by blazar
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2015-07-08 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls