Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: writing an address book program

by andreychek (Parson)
on Jun 07, 2001 at 00:48 UTC ( #86387=note: print w/ replies, xml ) Need Help??


in reply to writing an address book program

Data::Dumper and MLDBM would work quite well. However, this would
also be an excellent opportunity to make use of some XML.

In an XML file, you could simply say:

<addys> <reallyhotchick> <phone>555.555.5555</phone> <name>Jane Shmoe</name> <cell>555.555.5555</cell> <nick>reallyhotchick</nick> </reallyhotchick> </addys>
There are quite a few Perl modules at CPAN
which will parse an XML file for you. You can just go
there and do a search for 'XML'. I have in the past found
XML::Simple, XML::TokeParser, and XML::Twig to be useful.
Those three all use XML::Parser to do their dirty work.

If you're feeling particularly adventurous, you could always
try and use XML::Parser directly. However, most of what you may
want to do has already been implemented, and no need to
reinvent the wheel unless you're trying to learn how
something works :-)

Good Luck!
-Eric


Comment on Re: writing an address book program
Download Code
Re: Re: writing an address book program
by mexnix (Pilgrim) on Jun 07, 2001 at 00:54 UTC
    I hadn't thought of XML. I've actually been meaning to take a serious look at XML too. Thanks a bunch! Now I if I could only learn through osmosis...

    __________________________________________________
    %mexnix = (email = > "mexnix@hotmail.com", website => "http://mexnix.perlmonk.org");

      Osmosis.... MMmmmmmm... :-)

      Yeah, I actually picked up XML not too long ago myself.
      With the method you mentioned you are looking to use, XML::Simple
      might be your best bet.. you just point it to a XML
      file, and it will slurp the thing in and make it a
      hash of hashes (...of hashes of hashes, etc).

      However, just think how big this thing might get.. slurping the whole
      address book into a hash is loads of fun, but you might regret it later ;-)
      But you have to start somewhere, and XML::Simple is.. well.. simple :-) Have fun,
      -Eric

      There's an XML tutorial I found useful at w3schools, it's not Perl-related but a good intro to the world of XML.

      Update: After a comment by Beatnik I realised I should have included a link directly to the XML tutorial: here it is

      --
      Kevin O'Rourke
        In addition to the excellent XML tutorial Kevin mentioned,
        there is actually an XML::Parser tutorial located
        on PerlMonks that may help you get started if you are interested
        in working with XML::Parser, and not one of the higher level
        modules mentioned previously.

        Along with the useful tutorial provided at that node, it also contains the
        usual array of intelligent comments and code one often finds on this site.
        -Eric

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2014-09-23 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (221 votes), past polls