diff options
| author | fukachan <fukachan> | 2002-08-13 04:53:31 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-08-13 04:53:31 +0000 |
| commit | 110a75bc565cfa5cb4f43b54746cd89038b2c0bf (patch) | |
| tree | 3f99c98bfd7f7c097ad8dae55a77bbd8fb7c4b85 /fml/lib/Mail/Message/Decode.pm | |
| parent | 8410706db1b0a80da5a01702237bbfe6fc5a4d00 (diff) | |
| download | fml8-110a75bc565cfa5cb4f43b54746cd89038b2c0bf.tar.gz fml8-110a75bc565cfa5cb4f43b54746cd89038b2c0bf.tar.bz2 fml8-110a75bc565cfa5cb4f43b54746cd89038b2c0bf.zip | |
merge FML::Encode Mail::Message::Decode into Mail::Message::Encode
Diffstat (limited to 'fml/lib/Mail/Message/Decode.pm')
| -rw-r--r-- | fml/lib/Mail/Message/Decode.pm | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/fml/lib/Mail/Message/Decode.pm b/fml/lib/Mail/Message/Decode.pm deleted file mode 100644 index 1e455d4f..00000000 --- a/fml/lib/Mail/Message/Decode.pm +++ /dev/null @@ -1,106 +0,0 @@ -#-*- perl -*- -# -# Copyright (C) 2001,2002 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: Decode.pm,v 1.2 2002/05/23 12:47:50 fukachan Exp $ -# - -package Mail::Message::Decode; -use strict; -use vars qw(@ISA @EXPORT @EXPORT_OK); -use Carp; - - -=head1 NAME - -Mail::Message::Decode - decode a MIME encoded string - -=head1 SYNOPSIS - - use Mail::Message::Decode qw(decode_mime_string); - $decoded = decode_mime_string( $message ); - -=head1 DESCRIPTION - -MIME utilities to decode the string. It uses C<MIME::Base64> and -C<MIME::QuotedPrint> as decoding engines. - -=head1 METHODS - -=cut - - -require Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(decode_mime_string); - - -=head2 C<decode_mime_string(string, [$options])> - -decode a base64/quoted-printable encoded string to a plain message. -The encoding method is automatically detected. - -C<$options> is a HASH REFERENCE. -You can specify the charset of the string to return -by $options->{ charset }. - -=cut - - -# Descriptions: decode MIME string -# Arguments: STR($str) HASH_REF)$option) -# Side Effects: none -# Return Value: STR -sub decode_mime_string -{ - my ($str, $options) = @_; - my $charset = (defined $options->{ 'charset' } ? - $options->{ 'charset' } : - 'euc-japan'); - - if ($charset eq 'euc-japan') { - use MIME::Base64; - if ($str =~ /=\?ISO\-2022\-JP\?B\?(\S+\=*)\?=/i) { - $str =~ s/=\?ISO\-2022\-JP\?B\?(\S+\=*)\?=/decode_base64($1)/gie; - } - - use MIME::QuotedPrint; - if ($str =~ /=\?ISO\-2022\-JP\?Q\?(\S+\=*)\?=/i) { - $str =~ s/=\?ISO\-2022\-JP\?Q\?(\S+\=*)\?=/decode_qp($1)/gie; - } - } - - use Jcode; - &Jcode::convert(\$str, 'euc'); - $str; -} - - -=head1 SEE ALSO - -L<Jcode>, -L<MIME::Base64>, -L<MIME::QuotedPrint>. - -=head1 AUTHOR - -Ken'ichi Fukamachi - -=head1 COPYRIGHT - -Copyright (C) 2001,2002 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. - -=head1 HISTORY - -Mail::Message::Decode appeared in fml5 mailing list driver package. -See C<http://www.fml.org/> for more details. - -=cut - - -1; |
