Okay then, subclass the mk_accessors method in your class and stick the names of the fields passed to it into a hash. Then you can just dump that hash when you want it.
Thanks, I did end up subclassing the method in the end and storing the accessors names in a hash which can access.
The reason why I want the actual accessors names not the keys of the $self hash is I only want to dump values correctly set with the accessors not any keys set on the hash directly... Don't see why this is such a strange thing to request ?
An alternative solution: when you put non-accessor values into the hash, you can put them in with leading underscores or some other convention and skip them when dumping the object.