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];
        # $self->{$trainName} = new Train;
        # $self->{$trainName}->Load(@_);
        print "   Added train named ", $trainName, "<br>";
}

"Where no one has gone before!";


When I run perl -c on this, I get the following messages:
Subroutine new redefined at Train.pm line 106.
Useless use of a constant in void context at scheduleday.pm line 24.
scheduleday.pm syntax OK

What is going on here?  Why can't I have a class that uses another
class and have both classes have a "new" method?  What do I have to do
to get this scoped correctly?  

Also, I am getting strange behavior when running this through Internet
Explorer.  If the print statement in AddTrain() is modified to avoid
the use of $trainName, the program runs as expected and IE displays a
page with one line of print for every train I try to add.  However, if
I try to print the name of the train as contained in $printName (and as
shown above), the result age is never displayed and IE just waits and
waits and waits for something that never happens.

Can anyone explain either of these?

Thanks very much!

RobR


__________________________________________________
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]

Reply via email to