Object is nothing more than a blessed data structure, i.e. a hash or an arrary etc. (A hash of hash of hash is still a hash at each particular level, so we are dealing with no more than scalar, array/list and hash)
Basically, in order to be able to iterate over a data structure, you only need two things to support you:
- A way to determine what the data structure is, and this is not a big deal, as we have the isa function/method. Not just to recognize hash, array etc., you can actually even determine whether it is regexp, code, REF...
Data Dumper is one of those kind of tools that can iterate over any given data structure. But it only does some pre-determined 'hard-coded' thing for you, for example, to dump the content of the data structure.
- A general purpose 'iterator' should allow the user to define call-back functions, so its functionality can be extended by the user. For example, those HTML, or XML parsers support call-back functions.