ams has asked for the wisdom of the Perl Monks concerning the following question:
Also, in this sub, the code to not copy all the email header noise lines is also somewhat inelegant. Any sugestions? Criticisms?sub display_email { my ($fn) = @_; print "<center>file <i>$fn</i></center>\n"; if ( open( EMAIL, $fn ) ) { print "<hr width=600><br>\n<pre>"; while( $_ = <EMAIL> ) { if ( /^Message-Id:/ || /^Content-Type:/ || /^Content-Disposition:/ || /^Content-Transfer/ || /^X-[-\w]*:/ || /^Status: RO/ || /^Mime-Version:/ ) { next; } if ( /^\s/ && $rcvdflag ) { next; } if ( /^Received:/ ) { $rcvdflag = 1; next; } if ( /^[^ ]/ ) { $rcvdflag = 0; } if ( length($_) > 80 ) { chop; do { print substr( $_, 0, 80 ) . "\n"; if (length($_) > 80) { $_ = substr( $_, 80, length($_) - 80 ); } else { $_ = ""; } } while length($_); } else { print $_; } } print "</pre>\n"; close( EMAIL ); } }
|
|---|