Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Unanswered: Coursework question, And im really stuck!!

    Does anyone know how to implement a Perl object that reads XMLencoded
    data from a database.
    the object must make connection to a database using a DSN supplied to its constructor. The code should
    be relatively database-independent, but your submitted program must use DBD::CSV, with the files stored
    in a local directory (so that your program can run from a floppy as a self-contained unit).
    Your database must be able to maintain a shopping basket. You must store the following data:
    1) Login username
    2) Item_id (some product id)
    3) Number of items in cart (e.g. if a person is buying 1, 2, or more of the same item)
    4) Time_item added
    For part 1, you can assume that we don't ever change the number of an individual item being purchased.
    You must write a Perl object which can access the data in this table, with methods being:
    new_cart( user_name )
    add_item( user_name, item_id, number )
    remove_item( user_name, item_id )
    clear_cart( user_name )
    You will need to look up how to find the time in perl. You must make sure that you use a machineindependent
    method for finding the time. E.g. you mustn't assume Linux/Unix and use `date`.
    As well as your object, your floppy disk must include a brief Perl program that uses your object, and
    demonstrates that the functions work correctly. Note that this program is meant to be as minimal as possible,
    and marks will not be given (in fact they will be lost) for big fancy programs. Your test program should not
    do anything 'real', just call methods of your object with canned bogus data to show that your object code
    works. Your test program must use DBD::CSV (by supplying an appropriate DSN to your object's
    constructor), and a directory containing appropriate tables must be present on your disk. You must not put
    the disk name (e.g. A:\) into the DSN, it must give a f_dir for the database relative to the current directory.
    Your test program and database MUST run given just the floppy you hand in. No editing or configuration
    will be performed when testing/marking assignments.

    if anyone knows how to do this please let me know im really stuck on this coursework!!!! thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    5
    ok i found out that i need some modules, DBI, and something called DBD-CSV, but which one, there are sooo many? also i need one for the XML but can anyone point me in the right direction?

  3. #3
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    Quote Originally Posted by Davinder_Singh
    ok i found out that i need some modules, DBI, and something called DBD-CSV, but which one, there are sooo many? also i need one for the XML but can anyone point me in the right direction?
    Browse around search.cpan.org. I did a search for XML dump and got two very promising modules, XML:: Dumper will take a perl value and spit out XML and then do the reverse which seems to be just what you're looking for.

    You're going to have to learn how to build the modules manually since you need the whole thing to be self-contained on a floppy. That will be the hardest part, IMHO.

    See perldoc perlboot for a beginner's tutorial on OOP in Perl. That's all you need for this exercise.

    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •