Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

DVD Profiler...

by wrboyce (Initiate)
on Jan 12, 2005 at 04:01 UTC ( [id://421493]=perlquestion: print w/replies, xml ) Need Help??

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

I plan to write a DVD Profiler in Perl, and was wondering. What would be the best way to store all my data. I was thinking of referencing the DVDs by their EAN (example EAN: 060049145457) and then from that, being able to grab the rest of the info. At first, I thought XML would be a good idea, but then I had second thoughts.. Now, I am back to square one, and unsure, so I seek your guidance! I have included below the original XML file I was going to work with, so give you an idea of the data I will be storing.

<dvd EAN="060049145457"> <title>Reservoir Dogs: Special Edition</title> <director>Quentin Tarantino</director> <year>1992</year> <region encoding="PAL">2</region> <aspect anamorphic="0" widescreen="1">16:9</aspect> <audio>Dolby Digital 5.1</audio> <length>94</length> <cert>18</cert> <rating>5</rating> </dvd>

That kinda thing. Also, any comments/suggestion about data being held on dvds, or my DVD Profiler in general are welcome with open arms!

Thanks for any help provided in advance.
Regards, Will.

Replies are listed 'Best First'.
Re: DVD Profiler...
by DigitalKitty (Parson) on Jan 12, 2005 at 04:59 UTC
    Hi wrboyce.

    Storing your DVD information in an XML file would be perfectly fine but if you were / are considering another avenue of exploration, I would suggest a hash of hashes ( HoH ).

    #!/usr/bin/perl -w use strict; %DVDs = ( 'Reservoir Dogs: Special Edition' => { 'EAN' => '060049145457', 'director'=> 'Quentin Tarantino', 'year' => '1992', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '16:9', 'anamorphic' => 0, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 94, 'cert' => 18, 'rating' => 5, }, 'C programmers: A documentary' => { 'EAN' => '060049189573', 'director'=> 'Ken Thompson', 'year' => '1996', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '18:2', 'anamorphic' => 1, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 122, 'cert' => 16, 'rating' => 4, }, 'The History of Pascal' => { 'EAN' => '060054789573', 'director'=> 'Niklaus Wirth', 'year' => '1996', 'region' => 2, 'encoding' => 'PAL', 'aspect ' => '16:2', 'anamorphic' => 1, 'widescreen' => 1, 'audio' => 'Dolby Digital 5.1', 'length' => 175, 'cert' => 16, 'rating' => 4, }, );

    Since perl permits 'autovivication', creating new key / value pairs is exceptionally easy. Should my idea of using a HoH not appeal to you, I don't see where using your current solution could be deemed a hindrance. If your project required storing a large quantity of data, you might consider using an RDBMS (Relational Database Management System) such as PostgreSQL or MySQL (either of which has distinct advantages and disadvantages). I don't have any experience using postgresql (yet) but I can recommend a good book for learning MySQL:
    • Title: MySQL: The Complete Reference
    • Author: Vikram Vaswani
    • Publisher: Osborne/McGraw Hill
    • ISBN: 0-07-222477-0
    • Retail Price: $39.99

    as well as a useful site for related tutorials:

    Hope this helps,
    ~Katie
Re: DVD Profiler...
by BUU (Prior) on Jan 12, 2005 at 06:32 UTC
    I'm unsure what exactly a "DVD Profiler" is or does, but for storing your data, this sounds like the classic use for a Relational Database system, such Mysql, PostgreSQL or even SQLite. Using such a system you can easily create tables using columns for all of the different information. The advantages to this situation are numerous:

    1. Relational Databases are very fast. Lots of time has been spent making them fast. This is a good thing
    2. You can access the information easily by *any* of the categories you create. That is, you could easily and simply access all of the films by Quentin Tarantio, or names *like* tarantino and so forth
    3. Databases are very commonly used for these types of tasks, so there is a large body of knowledge on how to best use them, as well as a large body of knowledge on how to use the database from perl
    4. Many other reasons that will become apparent as soon as you start actually using it, but I can't list right now =]
Re: DVD Profiler...
by Mr. Muskrat (Canon) on Jan 12, 2005 at 05:18 UTC

    I'd recommend storing the information in a database. This will allow you to store a large number of DVD profiles and still be able to access the data in a short amount of time. You would also be able to dump the data into any format you want with minimal work (XML, CSV, HTML, etc...).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://421493]
Approved by DigitalKitty
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: (3)
As of 2024-04-24 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found