Since the discussion has broadened to serialization and deserialization here are a couple things I have done in PGObject which might also be generally useful (I would be happy to try to port to DBD::PG if folks are interested) related to this:
1. A standard interface for serialization. If an object has a to_db() method that gets called for serialization. This allows programmers to specify how a type serializes. You can also pass in containerized numbers or the like and specify how they get serialized. 2. A registry and standard interface for deserialization. You can register a class to take incoming types and pass them through a from_db() method. This allows for simple wrappers that turn numeric fields into Math::BigFloat objects for example. And the application gets to specify which types are important for conversion. We actually support multiple named registries so that different contexts can have different type mappings. This provides a more general approach to serialization and deserialization and one which pushes responsibility elsewhere but keeps things manageable. Best Wishes, Chris Travers Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor lock-in. http://www.efficito.com/learn_more
