- 论坛徽章:
- 1
|
问个MIME问题
沒用過MIME::* module...
我查了一下MIME的common type,你說的應該是屬於
multipart/*--->;a message containing multiple parts
可以的話..把代碼貼一下..比較清楚..
給你一個MIME:arser的例子...
#!/usr/bin/perl
# file: simple_parse.pl
use strict;
use MIME:arser;
my $file=shift;
open F,$file or die "can't open $file: $!\n";
# create and configure parser
my $parser = MIME:arser->;new;
$parser->;output_dir("/tmp"
# parse the file
my $entity = $parser->;parse(\*F);
print "From = " , $entity->;head->;get('From');
print "Subject = ", $entity->;head->;get('Subject');
print "MIME type = ",$entity->;mime_type,"\n";
print "arts = ",scalar $entity->;parts,"\n";
for my $part ( $entity->;parts){
print "\t",$part->;mime_type,"\t",$part->;bodyhandle->;path,"\n";
}
$entity->;purge;
^^^代碼取至Networking Programming with Perl...
雖然我沒用過,不過看起來,你應該是要parsing某個文件....
你可以試著打開那個文件..比較一下...
看看到底有沒有Parse 到你想要的內容.. |
|