☞ | ![]() ![]() |
46 |
This returns all observers of an object or class
Direct observers and class observers both
Before:
110 sub get_observers { 111 my ( $item ) = @_; 114 my @observers = (); 115 my $class = ref $item; 116 if ( $class ) { 119 push @observers, $item->_obs_get_observers_scoped; 120 } 121 else { 122 $class = $item; 123 } 126 push @observers, $class->_obs_get_observers_scoped, 127 $class->_obs_get_parent_observers; 129 return @observers; 130 }
I found the logic here really confusing
The if ($class) test is true when $item is not a class name
I wasn't sure why _obs_get_observers_scoped was called twice
(This might be a problem with my brain rather than with the code.)
☞ | ![]() |
☞ |