From 0488405f04eff9bbbf22258c52bcb1c5a92203ec Mon Sep 17 00:00:00 2001 From: fukachan Date: Sun, 8 Apr 2001 05:10:44 +0000 Subject: test tool to check dup_header(). show which key is differet or not --- regress/message/dup_header.pl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 regress/message/dup_header.pl diff --git a/regress/message/dup_header.pl b/regress/message/dup_header.pl new file mode 100755 index 00000000..22c31a83 --- /dev/null +++ b/regress/message/dup_header.pl @@ -0,0 +1,43 @@ +#!/usr/local/bin/perl +#-*- perl -*- +# +# Copyright (C) 2001 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: basic_io.pl,v 1.1.1.1 2001/04/07 12:47:01 fukachan Exp $ +# + +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 } ); + + $wh->autoflush(1); + $obj->print($wh); + + print "\n<< $f\n"; + + my $newobj = $obj->dup_header; + + for my $k (sort keys %$obj ) { + if ( $obj->{ $k } ne $newobj->{ $k } ) { + printf "%-15s is different.\n", $k; + print " $obj->{ $k } != $newobj->{ $k }\n"; + } + else { + printf "%-15s is same.\n", $k; + } + } +} + +unlink $tmp; + +exit 0; -- cgit v1.2.1