| Next | February 2001 | Slide #18 |
sub department {
my $self = shift;
if (@_) {
$self->{DEPT} = shift;
}
$self->{DEPT};
}
Suppose this is accidentally called as
Employee->department(...);
$self is Employee
Then $self->{DEPT} = ... becomes $Employee{DEPT} = ...
strict 'refs' will catch this
| Next | ![]() |
Copyright © 2001 M-J. Dominus |