Assignment for Perl Class- hurting my brain

From: William Paoli (magnetic8_at_yahoo.com)
Date: 08/08/04

  • Next message: Gunnar Hjalmarsson: "Re: Creating hash with multiple keys for an array"
    Date: Sun, 8 Aug 2004 00:24:59 -0700 (PDT)
    To: beginners@perl.org
    
    

    Im not looking to cheat, just a push in the right
    direction.

    This is assignment has to do with objects, classes,
    packages, classes.

    There is a text file that is comma delimited that we
    will have to get data from.

    The methods and what they will do are all layed out
    for us. I am stuck on creating the constrctor method,
    becasue the instructor gives us this:

    The field format of the file is structured like this:
    "Car Number":"Driver Name":"Sponsor":"Owner":"Crew
    Chief":"Car Make":"Mini Biography":"Team Name"

    --------------------------------------------------------------------------------
    To accomplish this project you must create a class and
    a Perl application to access the methods and data you
    create in your class.

    --------------------------------------------------------------------------------

    Specifications for Class:

    Name: Nascar.pm

    Description:
    A package for displaying and searching a Nascar
    driver's information.

    Attributes:
     ->Title - String title of our data (eg. Winston Cup
    2002 Drivers). The constructor method would be a good
    place to initialize/create this attribute. An
    attribute is simply a key/value pair in the anonymous
    hash that makes up your object.

    _______________________________

    So to this I am very confused and I wrote for my code:

    package Nascar;

    sub new{
            my $obj = {};

    $obj => {Title} =""; #Is this initilizing the
    attribute?

    bless $obj;

    }

    I dont know why I am just not getting this stuff.
    Please help me.

            
                    
    __________________________________
    Do you Yahoo!?
    New and Improved Yahoo! Mail - 100MB free storage!
    http://promotions.yahoo.com/new_mail


  • Next message: Gunnar Hjalmarsson: "Re: Creating hash with multiple keys for an array"

    Relevant Pages

    • Re: fstab and LABEL=
      ... Plus I agree with Tim that it would be better if we could be left in ... new package is installed, either on it's own or at the whim of a package ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (Fedora)
    • Re: yahoo messenger
      ... > Yahoo has officially updated messenger such that you can no longer connect ... People who are upset that the YMessenger package for FreeBSD isn't being ... support for third-party clients. ...
      (freebsd-questions)
    • Re: nvidia drivers & kernel headers
      ... I have the old video card re-installed-which is how I ... could use debian gui. ... > Reading Package Lists... ... > Do you Yahoo!? ...
      (Debian-User)
    • Re: Package system question
      ... > (defun fetch-xml (query format start results) ... > "fetch the yahoo XML sheet" ... > package (because when using xmlisp, the reader only looks for xml ...
      (comp.lang.lisp)
    • Re: yahoo instant messenger (im)
      ... It's available from Yahoo (http://messenger.yahoo.com/, right-hand side, ... an official Debian package. ... for those non-Yahoo clients to release a new client that works again. ... I tend to use gaim myself, falling back on ymessenger and/or the web ...
      (Debian-User)