Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Different Ways to Do It

by nimdokk (Vicar)
on Jun 14, 2004 at 10:11 UTC ( #366463=perlquestion: print w/ replies, xml ) Need Help??
nimdokk has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

Currently I am working on a database for my album collection (mainly CDs and vinyl records). I am storing everything in a rather elaborate hash of hashes. I've got several routines set up right now that will allow me to add a new entry, modify an existing entry and then when I am done dump everything to a file (the file gets read in and populates the hash whenever the script starts.

What I am wondering is if there might not be a better way to do what I am doing, something perhaps more efficient? I've been toying with the idea of playing around with MySQL (since I've got that on my Linux box). Suggestions for things I might look at or try? I'd rather make big changes earlier on, before I spend a lot of time inputting information. Any comments would be appreciated.

Thanks in advance.

Comment on Different Ways to Do It
Re: Different Ways to Do It
by neniro (Priest) on Jun 14, 2004 at 10:24 UTC
    What kind of database to use depends mostly on the ammount of records you want to handle. For small to med-sized apps MySQL or SqLite are fine. If you don't need an SQL-able database you can alternatively use YAML or XML based flatfiles.

    neniro

Re: Different Ways to Do It
by adrianh (Chancellor) on Jun 14, 2004 at 10:41 UTC

    You might want to look at building something with Class::DBI.

Re: Different Ways to Do It
by liz (Monsignor) on Jun 14, 2004 at 11:07 UTC
    Thinking about different ways to do it. It's really too bad that you can't use iTunes just as a database system for this by itself.

    Personally, that has solved all of my music database needs (and then some).

    Liz

Re: Different Ways to Do It
by bradcathey (Prior) on Jun 14, 2004 at 11:15 UTC
    I have used flat file systems in the past, but find they usually require a bit more code overhead than MySQL. Because it is so readily available, I now use MySQL for even the most simple of tasks. It's fast, easy and can handle anything I throw at it.

    —Brad
    "Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton
Re: Different Ways to Do It
by dragonchild (Archbishop) on Jun 14, 2004 at 11:30 UTC
    You will want to use a RDBMS. MySQL, since you have it, sounds like a good choice.

    As for wanting to deal with this before inputting data ... that's a straw man. It is the matter of a few minutes to take your old reading routine and your new writing routine and hook them together. Data and algorithms should be dealt with separately.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: Different Ways to Do It
by hmerrill (Friar) on Jun 14, 2004 at 11:50 UTC
    Just for the sake of completeness I'll also suggest that you consider using PostgreSQL which, like MySQL is Open Source and free software. For using MySQL I found it very helpful to have Paul Dubois' book "MySQL" handy as a reference, and to help get you through the initial learning curve with MySQL setup and security issues.

    Note that no matter what database you decide to use, consider strongly using Perl DBI (Database Independent Interface) as the perl interface to the database. Assuming you decide to go with MySQL, you would

    - install MySQL and get it working with the "mysql" client, and then - download and install the perl "DBI" module - read the DBI perldocs by doing "perldoc DBI" at a command prompt - download and install DBD::mysql - read the DBD::mysql perldocs by doing "perldoc DBD::mysql" at a command prompt
    That should get you started.

    HTH. </code>

Re: Different Ways to Do It
by xdg (Monsignor) on Jun 14, 2004 at 14:26 UTC

    You might consider looking into Maypole -- Simon Cozens framework for web-based, database-driven applications. There's a nice article Rapid Web Applications Development with Maypole and Part Two on perl.com that shows how quickly a simple application (in this case a e-commerce site and shopping cart) can be built.

    -xdg

    Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-09-02 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls