R
RyanMcCoskrie
I'm trying to piece to gether a adventure like[1] game.
This is something that I have copied almost straight from the man
page:
The trouble starts here though:
These three lines (in the buildWorld() subroutine) result in the error:
Have I done something wrong? Or is this an interpreter issue?
[1]This may turn into "Indiana Jones and the recursive macro processor"
for the sake of silliness.
This is something that I have copied almost straight from the man
page:
package room_t;
use exit_t;
sub new()
{
my $self = {};
my $class = shift;
$self->{NAME} = shift;
$self->{NUMBER}= shift;
@{$self->{EXITS}} = [];
return bless($self, $class);
}
The trouble starts here though:
$temp = room_t->new("Start", 0);
push(@world, $temp);
$world[0]->addExit("End", 1);
These three lines (in the buildWorld() subroutine) result in the error:
Can't call method "addExit" on unblessed reference at ./game.pl line 22.
Have I done something wrong? Or is this an interpreter issue?
[1]This may turn into "Indiana Jones and the recursive macro processor"
for the sake of silliness.