summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-03-12 14:54:52 +0000
committerfukachan <fukachan>2004-03-12 14:54:52 +0000
commit04d7fc026efee109c00aa9dc38e8d7a050e03641 (patch)
treeb59184020253adb28a093c30f8e2f625b343b93d
parent9245cf815086558b30d8b34e32ab67902145700c (diff)
downloadfml8-04d7fc026efee109c00aa9dc38e8d7a050e03641.tar.gz
fml8-04d7fc026efee109c00aa9dc38e8d7a050e03641.tar.bz2
fml8-04d7fc026efee109c00aa9dc38e8d7a050e03641.zip
test of some Mail::* classes
-rwxr-xr-xregress/message/header.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/regress/message/header.pl b/regress/message/header.pl
new file mode 100755
index 00000000..ff4e35ae
--- /dev/null
+++ b/regress/message/header.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/env perl
+#-*- perl -*-
+#
+# Copyright (C) 2004 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $FML$
+#
+
+use strict;
+use Carp;
+use lib qw(../../cpan/lib);
+use Mail::Message;
+
+my $tmp = "/tmp/buf$$";
+
+for my $f (@ARGV) {
+ my $fh = new FileHandle $f;
+ my $wh = new FileHandle "> $tmp";
+ my $obj = Mail::Message->parse( { fd => $fh } );
+ my $hdr = $obj->whole_message_header();
+ my $from = $hdr->get('from');
+
+ use Mail::Address;
+ my (@addrlist) = Mail::Address->parse($from);
+
+ for my $a (@addrlist) {
+ my $address = $a->address();
+ print "address: $address\n";
+
+ my $comment = $a->comment();
+ print "comment: $comment\n";
+
+ my $phrase = $a->phrase();
+ print "phrase: $phrase\n";
+ }
+
+ print "\n";
+}
+
+unlink $tmp;
+
+exit 0;