[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldsync-hackers] Setting time



In a year-old message Andrew Arensburger wrote about setting time:

>        If you want something that'll set the time each time you sync, and
>you use ColdSync (which I assume you are, since you sent your question
>here), I suggest that you write a Sync conduit for, say, "Saved
>Preferences".

Done that, but failed miserably. The straightforward way:

	conduit sync {
		path: "/home/hmo/palm/SetSysDateTime.pl";
		type: psys/sprf;
	}

with the script simply being

	#!/usr/bin/perl

	use strict;
	use ColdSync;
	use ColdSync::SPC;

	StartConduit("sync");

	@_ = localtime(time);
	$_[5] += 1900;
	++$_[4];
	&dlp_SetSysDateTime(reverse @_[0..5]) && die "501 Cannot SetSysDateTime";

	EndConduit;

The script fails because there are no handlers defined for creator
"psys" and type "sprf". The error ist raised via the virtual constructor
that creates $PDB in StartConduit() in ColdSync.pm. Of course there is
no handler for psys/sprf - but I don't care about a handler: I don't
care about the InputDB at all, neither do I care about OutputDB.

I don't see how I can call something similar to

	&Palm::PDB::RegisterPDBHandlers("Palm::PDB",
		[ "psys", "sprf" ],
		);

to bless the not-yet-new()ly created object properly. Of course I could
write a Palm::PSys module, but that's a bit of overkill just for a
ten-liner to set the time, isn't it?

Any ideas? Maybe we need a stripped-down variant of StartConduit that
doesn't touch $PDB, i.e. doesn't Load() it from InputDB and Write() to
OutputDB?

(The core problem was easy to solve, of course. Creator/type memo/DATA
and "use Palm::Memo;" do the job fine as there should be exactly one
database of this creator/type.)

Thanks,
Helge
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.