#!/usr/bin/perl
#$Id: delmeta.pl,v 1.1 2001/02/25 21:20:31 connolly Exp $

use strict;
use Palm::Datebook; # http://www.ooblick.com/software/coldsync/

main();

sub main{
    my $pdb = new Palm::PDB;

    $pdb->Load("DatebookDB.pdb");
    delMeta($pdb);
    $pdb->Write(",no-meta.pdb");
}

sub delMeta{
    my($pdb) = @_;
    my($record);

    foreach $record (@{$pdb->{records}}){
	print STDERR $record->{note} le "", "\n" if $record->{description} eq "meta";
	if($record->{description} eq "meta"
	   && $record->{note} le ""){
	    print STDERR "deleted record ", $record->{id}, "\n";
	    $pdb->delete_Record($record, 1);
	}
    }
}
