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

Re: [MacPerl] <MAIL> chunk 113. ?



At 9:45 AM -0400 10/11/99, Karl Long wrote:
>Well I'm just learning perl and here's a snippet from a program that 
>will eventually convert eudora mailboxes into html pages.
>This is my first attempt at a perl program and I've learned a lot by 
>wrestling with it, but I'm baffled by an error that keeps coming up.
>this was a test to read from a file and incrementaly load an array 
>when ever I come across a from field.
>This works fine but when I add the $file++; then I get:
>Use of uninitialized value, <MAIL> chunk 113.
>
>thanks,
>karl
>
>
>#!perl -w
>
>$inPath = "test y";
>
>$outPath = "test x";
>
>$file=0;  #init my file count
>
>open (MAIL, $inPath) || die "can't open: $!";
>open (MAILOUT, ">$outPath$file.html") || die "can't open: $!";
>@a = <MAIL>;

You should look into Graham Barr's MailTools, which works with 
MacPerl and comes with cpan-mac or can be found in any CPAN archive. 
It has a routine Mail::Util::read_mbox that reads standard Unix mbox 
files (which Eudora's mailboxes are) and splits them into individual 
messages, which you can then do what you want with.

Anyway, I tried your script and it works for me.  It's the print 
statement that's giving you the errors (for some reason).  I don't 
know what you're trying to accomplish with the @auther in the string, 
but removing it will get rid of the warnings.

>foreach (@a) {
>	 chomp;
>	if (/From:/) {
>	$file++; #if I take this out it runs fine
>	#if I leave it I get # Use of uninitialized value, <MAIL> chunk 113.
>	$auther[$file] = $_;
>print STDOUT "this is $auther[$file] and the file is $outPath$file\n 
>and this is the @auther\n\n";
>		}
>}
>close (MAIL) || die "can't close  MAIL: $!";
>close (MAILOUT) || die "can't close  MAILOUT: $!";
>
>	-==Karl Long==-
>	     -== mailto:klong@viant.com?subject=the%20money%20IOU ==-
>	-== http://www.viant.com ==-
>		-= aol im: mrukfunky =-
>-=42 is the answer, the only problem is figuring out the question=-
>
># ===== Want to unsubscribe from this list?
># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org

--
Paul Schinder
schinder@pobox.com

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org