Joseph,
Thanks for your comments. Let's see if I can snip this and still come
up with intelligible contexts.
--- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote:
> Rob Richardson wrote:
>
> > Greetings!
> >
> > I have the following class in a .pm file:
> >
> > use warnings;
> > use strict;
> > package ScheduleDay;
> >
> > use Train;
> >
> > sub new
> > {
> > my $self = {}; # $self is a reference to an anonymous,
> empty (for
> > now) hash
> > bless $self;
> > return $self;
> > }
> >
> > sub AddTrain
> > {
> > my $self = shift;
> > my $trainName = $_[0];
>
> How are you calling this function. the formulation above looks like
> the call should be:
> AddTrain($schedule_day_object, $train_name);
I have created a ScheduleDay object within my Schedule class by calling
ScheduleDay->new(). Because the return value from new() is blessed, I
don't need to pass in the ScheduleDay object explicitly. Or at least,
that's how I understand it.
The parameter I explictly pass in to AddTrain is an array of 14
elements, the first of which is the train name. I am using the name
here as the key to a hash element, and I am also going to store it in
the Train object through the call to Train->Load(), so I don't want to
shift it out of the array.
<snip>
> > # $self->{$trainName} = new Train;
> > # $self->{$trainName}->Load(@_);
> > print " Added train named ", $trainName, "<br>";
> > }
> >
> > "Where no one has gone before!";
>
> $trainName ain't there. You've already commented out to lines
> dependent on this variable. Presumably this was because they raised
> errors. Check how you are getting a value into $trainName.
> Something is going wrong there.
>
> Joseph
Your presumption is not correct. I commented them out because I didn't
want to test the new() and Load() methods yet. I just wanted to make
sure that the AddTrain() method was getting called as expected and was
finding the train name as expected. Once I got that point, I was going
to remove the #s and see if those functions worked. Unfortunately, I
haven't got to that point yet.
Rob
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]