[DCPM] shorthand required

Neil Williams linux at codehelp.co.uk
Sat Feb 17 14:37:15 PST 2007


On Sat, 17 Feb 2007 21:56:36 +0000
Neil Williams <linux at codehelp.co.uk> wrote:

Actually, I think I've got most of it - following the model of the
upstream C source code which separates the DATA from the OBJECT:

my %objects = ();
my %todos = ('todo_note' => 'string',
	'todo_description' => 'string',
	'category' => 'string',
	'guid' => 'guid',
	'date_due' => 'time',
	'todo_priority' => 'gint32',
	'todo_complete' => 'gint32',
	'todo_length' => 'gint32');

$objects{'pilot_todo'} = \%todos;

$field = 'pilot_todo';
$param = 'date_due';

print $objects{$field}->{$param};

(this prints 'time').

Therefore, I can have a struct for the instances that contain the user
data and the definition for the meta-data, one def per backend.

I can use the above to create the XML snippet:
<object type="pilot_todo">
  <time type="date_due"/>
</object>

and also call something like:
$t->date_due as $foo->$param
to retrieve the data to insert into the <time> tag.

<object type="pilot_todo">
<time type="date_due">2005-07-27T00:00:00Z</time>
</object>

Thanks, Aaron.

--


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/devoncornwall-pm/attachments/20070217/f396b066/attachment.bin 


More information about the Devoncornwall-pm mailing list