Both can_see and can_hear functions are based on the same is_within_perception function that is shown in the example hook script.
The only difference is can_hear (fixed with sfall option enabled) has no blocking check, i.e. the source object can "see" through walls.