in reply to Can't call method "foo" on unblessed reference

I believe your syntax for initializing your class is incorrect in sub new
Try the following in its place

sub new { my $class = shift; my $self = { }; bless($self, $class); $self->init(@_); return $self; } sub init { my $self = shift; my ($board, $index, $level, $links ) = @_; $self->{board} = $board; $self->{index} = defined( $index ) ? $index : 0; $self->{level} = defined( $level ) ? $level : 0; $self->{links} = defined( $links ) ? $links : []; }

UPDATE
my apologies for this post. I was not aware that the syntax used to init an object as used here was valid. I have always initted my objects in the way I provided. Many sorrows for the confusion.

davidj

Replies are listed 'Best First'.
Re^2: Can't call method "foo" on unblessed reference
by Anonymous Monk on Jun 16, 2004 at 19:03 UTC
    I believe your syntax for initializing your class is incorrect in sub new
    Why? Its practically identical to what you wrote.