It’s saying this because for some reason the second param to bless in your ->new() constuctor is not the name of the Object you want your reference to be, but instead it is itself a reference!
It could be that you’re passing a string reference to bless rather than a string itself in which case you’ll need to double $$ it. But in my case, like a donkey, I’d written:
my $fish = new Fish->new();
Fantastic.
I’ve just done it again oddly. No more than an hour later.
This time. I’ve tried to create a new object from it’s own handle. i.e.
$self->new();
rather than
TheClassName->new();
So bless is getting $self rather than “TheClassName” as it’s second parameter.
The idiom for that is (ref $self)->new, not $self->new. It’s a good thing Perl catches this.
July 10th, 2006, at 9:46 pm #Damn good job it catches it. Good job it catches a lot of things knowing how I usually code
July 11th, 2006, at 8:30 pm #