☞ | ![]() ![]() |
45 |
169 foreach my $parent ( @parent_path ) { 171 if ( $parent->isa( 'Class::Observable' ) ) { 172 push @observable_parents, $parent; 173 } 174 }
Now what about line 171?
Suppose Alarm has a base class that is not derived from Class::Observable?
Say, class X
But suppose we put X into @observable_parents anyway
What if we left out this special case?
Well, in this case a problem
Later on, we would try to call X->_obs_get_observers_scoped
This would throw Can't locate object method ... via package "X"
OK, fair enough
But perhaps the right test is to add a guard condition to line 182:
182 push @parent_observers, $parent->_obs_get_observers_scoped if $parent->can('_obs_get_observers_scoped');
What do you think?
☞ | ![]() |
☞ |