Kzin has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, I have tried a couple diferent methods of opening the filestream, and even tried adding the :crlf thingie. The goal here is to get the file "Google" to write as ASCII Text. =/#!/usr/bin/perl use MIME::Parser; open LOG, ">>/home/autotasks/.procmail/inputlog"; # Create MIME::Parser mail object my $mime = MIME::Parser->new; $mime->output_to_core(0); my $entity = $mime->parse(\*STDIN) or die "Parse failed\n"; foreach my $part ($entity->parts) { my $filename = $part->head->recommended_filename; if ($filename eq 'overture.txt') { my $sender = $part->head->get('From',0); #save file to overture directory and log printf LOG "Overture: $sender\n"; open OVERTURE, ">/home/autotasks/bidWatch/over +ture.txt"; printf OVERTURE $part->bodyhandle->as_string; close OVERTURE; } elsif ($filename eq 'Google') { my $sender = $part->head->get('From:',0); my $filepath = "/home/autotasks/pricemonitor/$ +filename"; printf LOG "$filename: $sender$filepath\n"; #open BIDWATCH, ">$filepath"; #open BIDWATCH, ">/home/autotasks/pricemonitor/Google"; open (BIDWATCH, ">:crlf", $filepath); printf BIDWATCH $part->bodyhandle->as_string; close BIDWATCH; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Force Ascii Write
by moklevat (Priest) on Apr 05, 2006 at 19:06 UTC | |
by Kzin (Acolyte) on Apr 05, 2006 at 19:18 UTC | |
by ikegami (Patriarch) on Apr 05, 2006 at 21:08 UTC | |
by Kzin (Acolyte) on Apr 05, 2006 at 22:49 UTC | |
by ikegami (Patriarch) on Apr 06, 2006 at 01:50 UTC | |
| |
|
Re: Force Ascii Write
by Kzin (Acolyte) on Apr 06, 2006 at 18:01 UTC | |
by ikegami (Patriarch) on Apr 06, 2006 at 18:09 UTC | |
by Kzin (Acolyte) on Apr 06, 2006 at 18:30 UTC |