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

Re: [coldsync-hackers] p5-Palm perl module



On Tue, Jan 28, 2003 at 12:57:23AM -0500, Michael D. Spiceland wrote:
> Does anyone  have a simple example using the p5-palm perl module.  I
> just want to open the datebook PDB, read out a few of the entries,
> perhaps add some new ones, and save it again. If I had an example of
> something similar to this, I would surely be able to figure out how to
> do what I need.

	Try this: copy ~/.palm/backup/Datebook.pdb to /tmp/foo.pdb,
and run the following script:

	#!/usr/bin/perl
	use strict;
	use Palm::Datebook;
	use vars qw( $pdb );

	$pdb = new Palm::PDB;
	$pdb->Load("/tmp/foo.pdb");

	foreach my $record (@{$pdb->{records}})
	{
		$record->{description} =~ s/meeting/waste of time/ig;
	}

	$pdb->Write("/tmp/bar.pdb");

You can use 'pdbdump' to compare /tmp/foo.pdb and /tmp/bar.pdb, and
note that "meeting" has been replaced with "waste of time".

-- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
   Drink Canada Dry! You might not succeed, but it *is* fun trying.
-- 
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.