in reply to Re: Classes Are Killing Me
in thread Classes Are Killing Me
It actually did not work at all. Besides, the second simplest constructor in the perl cookbook was sub new{ bless({},shift);} I saw that in the reference they had shifted off of $self for every function, but as I said earlier I was just copying the code to local vars and only now realize that I can only have one instance of the class if I do that. Yes I realize how to shift of $self, but even when I had all the things that were just descibed, I still could not call the functions like this:$foo->name("straywalrus");. Instead I had to call every function with the class name preceding the function name with the C++ scope operators betwixt the two ( I have no idea what the scope "::" operator is called in Perl). Every call was made like it was shown in the test program. Surely there is a way to correct this, even though I shift off $self and do as was above described. Thanx straywalrussub new { my $class = shift; my $self = {}; return bless $self, $class; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Classes Are Killing Me
by chromatic (Archbishop) on May 19, 2002 at 05:17 UTC |