Assignment for Perl Class- hurting my brain
From: William Paoli (magnetic8_at_yahoo.com)
Date: 08/08/04
- Previous message: Edward Wijaya: "Re: Creating hash with multiple keys for an array"
- Next in thread: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Reply: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Maybe reply: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Reply: Christopher J. Bottaro: "Re: Assignment for Perl Class- hurting my brain"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Edward Wijaya: "Re: Creating hash with multiple keys for an array"
- Next in thread: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Reply: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Maybe reply: James Edward Gray II: "Re: Assignment for Perl Class- hurting my brain"
- Reply: Christopher J. Bottaro: "Re: Assignment for Perl Class- hurting my brain"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|