I'm afraid I still don't see what I've done wrong. The code I have used comes in three blocks, but it all fits in a single screen on my browser. The relevant section is
A horse is a horse, of course of course, or is it?
and I see nothing in it about class versus object methods, nor any suggestion that the code needs to change. The only change I have made (apart from the two lines mentioned previously) is the "our", which the tut seemed to indicate I should put in. But I've tried taking it out and taking Strict out, and with all four combinations I still get the SCALAR reference in the output. If you could give me any further clues, I'd be most grateful. In case it's system dependent, I'm using ActiveState v5.10.0 on Losedows XP Home.
Regards,
John Davies | [reply] |
Eh, no, that's not the only change. The big, fundamental change is that you are taking subs that are intended to be called as class methods, (Class -> subname), but call them as object methods ($obj = bless $ref, Class; $obj -> subname). Big difference. A difference that's about to be introduce around the point you copied and pasted from perlboot. The fact you don't quote the second argument to bless cause the strict error; the fact you call a class method as an object method gives you the funny animal name.
| [reply] [d/l] [select] |