From pug at taut.oau.org Sun Jan 9 19:24:03 2000 From: pug at taut.oau.org (Perl Monger) Date: Thu Aug 5 00:08:23 2004 Subject: Perl code to convert mail digests Message-ID: <200001100124.UAA03090@taut.oau.org> Hello PerlMongers, Has anyone seen any source code posted to convert a mail digest to a mbox formatted file? regards, // David // From pug at taut.oau.org Thu Jan 20 11:58:37 2000 From: pug at taut.oau.org (Perl Monger) Date: Thu Aug 5 00:08:23 2004 Subject: Found good place to 'host' new page. In-Reply-To: <011d01bf61d1$f6151860$e6a1acc6@oemcomputer> from "Robert J Van Der Ploeg" at Jan 18, 2000 11:34:57 AM Message-ID: <200001201758.MAA06286@taut.oau.org> Bob wrote: > Hi Dave. I wanted to get back to you long before this but.... > excuse excuse excuse I did not know that Orlando PM was looking for > a place to host a site. I don't think our group has really gotten > off the ground yet. Do you know how many people are in the group? I > would love to get more involved. Hello Bob, I don't think that there is many of us here. I wonder if it might be because if anyone followed the web link from the main PerlMonger web site they would find a dead link to Orlando. All I was looking for at this time was to fix that problem. A simple one or two page web presence to mention how to join this list would be good. If anyone would volunteer to write the content I would see that it would get hosted and maintained. I also belong to a local Linux users group and several members there are interested in hacking perl from time to time. They might join us here if we became more active. regards, // David // From pug at taut.oau.org Sat Jan 29 13:24:01 2000 From: pug at taut.oau.org (Perl Monger) Date: Thu Aug 5 00:08:23 2004 Subject: Address book hack Message-ID: <200001291924.OAA01118@taut.oau.org> PerlMongers, Here is a hack to move your elm mailer address book to the Palm Desktop software to HotSync to your palmtop. Use at your own risk! #!/usr/bin/perl -w # # Author: David Billsbrough (kc4zvw@mpinet.net) # # $Id: elm2palm,v 0.1 2000/01/29 18:59:48 kc4zvw Exp $: # $Revision: 0.1 $: # # Created: Saturday, 29 January 2000 at 06:55am EST # Warranty: None # # Purpose: Convert an elm address book for use with # : 3COM PalmIIIx palmtop computer. # ###------------------------------------------------------### require strict; sub get_home_dir { local ($myHOME) = $ENV{"HOME"}; print "My \$HOME directory is $myHOME.\n"; return $myHOME; } sub get_timestamp { local($tmstamp); local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); $tmstamp = sprintf("%02d-%02d-%04d at %02d:%02d:%02d (local)", $mon + 1, $mday, 1900 + $year, $hour, $min, $sec); return($tmstamp); } sub delete_comment { return substr($_[0], 0, $_[1]); } sub get_firstname { return substr($_[0], $_[1] + 2); } sub get_lastname { return substr($_[0], 0, $_[1]); } sub get_fullname { local ($full_name); local ($first_name) = $_[0]; local ($last_name) = $_[1]; $full_name = $first_name . " " . $last_name; return $full_name; } sub display_entry { local ($full_name) = @_; print("Converting \"$fullname\" {$.}\n"); } sub write_palm_entry { local ($alias, $first, $last, $email) = @_; print OUTPUT "\"$last\","; # Last Name print OUTPUT "\"$first\","; # First Name print OUTPUT "title,"; # Title print OUTPUT "company,"; # Company print OUTPUT "000-0000,"; print OUTPUT "555-1212,"; print OUTPUT "555-1212,"; print OUTPUT "pager,"; print OUTPUT "\"$email\","; print OUTPUT "street,"; print OUTPUT "city,"; print OUTPUT "state,"; print OUTPUT "zip,"; print OUTPUT "USA,"; print OUTPUT "\"$alias\","; print OUTPUT "0,"; print OUTPUT "Unfiled"; print OUTPUT "\n"; } sub write_header { print OUTPUT "# Address Book for Palm Pilot\n"; } sub process_line { local ($line); local ($pos1, $pos2); local ($alias, $name, $email); local ($first) = ""; local ($last) = ""; local ($fullname) = ""; $line = readline(*INPUT); chomp($line); # frag the newline ($alias, $name, $email) = split(' = ', $line, 3); $pos1 = index($name, ','); # search for a comma $pos2 = index($name, ';'); # search for a semicolon #print "comma at '$pos1', semicolon at '$pos2'\n"; if ($pos1 > 0) { $name = &delete_comment($name, $pos1); } if ($pos2 > 0) { $first = &get_firstname($name, $pos2); $last = &get_lastname($name, $pos2); } $fullname = &get_fullname($first, $last); &display_entry($fullname); # display progress &write_palm_entry($alias, $first, $last, $email) # write CSV entry } ###------------------- Main Routine ---------------------### local ($home) = &get_home_dir; local ($timestamp) = &get_timestamp; local ($elm) = join("/", $home, ".elm", "aliases.text"); local ($palm) = join("/", $home, "email3.csv"); print "The elm mail alias file is $elm.\n"; print "The Palm address book file is $palm.\n\n"; open(INPUT, '<' . $elm) or die "Can't read input mail aliases : $!"; open(OUTPUT, '>' . $palm) or die "Can't write output address book : $!"; &write_header; &process_line until eof(INPUT); $timestamp = &get_timestamp; print "\n"; print "Completed $. records on $timestamp.\n"; close INPUT; close OUTPUT; # End of Program regards, // David //