in reply to Detecting cyclic graphs

OT
Data::Structure::Util

has_circular_ref($ref)
If a circular reference is detected, it returns the reference to an element composing the circuit.

circular_off($ref)
Weaken any reference part of a circular reference in an attempt to break it.