Add a plane on perspective camera looking forward.
As a quick work around is to add a plane looking forward on a perspective camera, by adding this
else clause circa line 32 of original code.
if not is_persp:
# add a 5th plane to ignore objects behind the view
n = normal(frame, frame, frame)
d = -n.dot(origin)
n = (matrix * Vector((0, 0, -1)) - origin).normalized()
d = 0
A cameras line of view is its negative local Z axis. All above does is adds a plane that has a global normal looking in the same direction.
Image shows plane with normal, the Z axis pointing in direction of camera's -Z axis.