[prev] [thread] [next] [Date index for 2005/01/31]
Just thought I'd share. I needed to map CDBI objects to REST output, and I wanted to do it cheaply, so Class::DBI::AsXML was formed. Here's some example usage. Ignore the internal-type code if you can. perl -MMailClue -le' print $_->to_xml for MailClue->data("Account")->retrieve_all' And the output would look like this: <account> <id>6E9912B8-73DE-11D9-96A8-914BC86F4044</id> <email_address><casey@xxxxxxxx.xxx></email_address> <fullname>Casey West</fullname> <username>casey</username> </account> Next, I have need for a multi-master replication system. Auto incremented and/or sequentially generated IDs were no longer useful to me. Since I'm using CDBI, I obviously want to keep my code as database unspecific as possible, so I wanted to generate IDs myself. So entere Class::DBI::UUID. You can see its use in the above XML output. <id>6E9912B8-73DE-11D9-96A8-914BC86F4044</id> That's a UUID string that will be globally unique. No need for composite primary keys this way. Maybe someone else will also find these useful. Later. Casey West -- "Please leave your values at the front desk." --In a Paris Hotel Elevator
My Recent CDBI Hackery
|
Generated at 12:39 on 05 Feb 2005 by mariachi v0.52