in reply to correct usage of class attributes
But a serious problem with your code above is that you don't declare $self to be a local variable. The results of that could be quite unpredictable. If this is really how your code is (and not just a typo in the sample code), you have one $self variable for the entire class, and every time you call an object method, that will get overwritten. This probably won't cause problems very often in real life, but when it does, they'll be of the awful and hard to find variety. :)
Instead, you should use:
my $self = shift;
|
|---|