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

[coldsync-hackers] memo-text conduit



With the latest version of the p5-palm modules, the memo-text conduit on
the ooblick.com web site is no longer working. It appears that the data
structure for the memo records has changes just a little, making the
category entry a hashref rather than a scalar.

I've attached a diff which clears up the problem. I'm running coldsync
1.4.6 and the 1.2.4 distribution of the p5-perl modules. If you're
running an earlier version of the Perl modules, this diff will not help
you, but you'll find that if/when you upgrade you'll start getting
strange entries in your memo dump file.

I expect I'll have some more diffs for this conduit some time in the
near future, since it does not do quite what I want it to. Is posting
these diffs to this mailing list appropriate, or should they go
somewhere else?

-- 
    Rich Bowen --  Director of Web Application Development
   http://www.cre8tivegroup.com/  --  rich@cre8tivegroup.com
Have trouble remembering things?   http://www.mymissinghead.com/
--- memo-text.1.2.5	Mon Jan 15 12:12:16 2001
+++ memo-text	Fri Jan 19 11:01:09 2001
@@ -229,37 +229,30 @@
 
 sub DoDump
 {
-	my $i;
-
 	# XXX - Read the original output file. Copy the first
 	# $HEADERS{Skip} lines.
 
 	open OUT, "> $HEADERS{File}" or
 		die "401 Can't open \"$HEADERS{File}\": $!\n";
 
-	# Dump category names.
 	print OUT "Categories:\n";
-	for ($i = 0; $i <= $#{$PDB->{"appinfo"}{"categories"}}; $i++)
-	{
-		my $category = $PDB->{"appinfo"}{"categories"}[$i];
-		my $cat_id = $PDB->{"appinfo"}{"uniqueIDs"}[$i];
-
-		next if $category eq "";
-		$category =~ s/,/\\,/g;		# Escape commas
-		print OUT "    $cat_id: $category\n";
-	}
+     foreach my $cat ( @{ $PDB->{appinfo}{categories} } ) {
+          my $cat_id = $cat->{id};
+          next unless $cat_id;
+          my $category = $cat->{name};
+          $category =~ s/,/\\,/g;
+          print OUT "    $cat_id: $category\n";
+     }          
 	print OUT "END\n";
 
-	my $record;
-
-	foreach $record (@{$PDB->{"records"}})
+	foreach my $record (@{$PDB->{"records"}})
 	{
 		my @f;
 
 		print OUT "Memo ";
 		print OUT "ID: ", $record->{"id"};
 		print OUT ", Category: ",
-			$PDB->{"appinfo"}{"categories"}[$record->{"category"}];
+			$PDB->{"appinfo"}{"categories"}[$record->{"category"}]->{name};
 		print OUT ", Private" if $record->{"attributes"}{"private"};
 		print OUT "\n";
 
@@ -273,3 +266,4 @@
 
 	close OUT;
 }
+