Subject: | use LWP::MediaTypes instead of GuessCType (with patch) |
If you used:
use LWP::MediaTypes qw(guess_media_type);
you could replace:
use vars qw(%CTypes);
%CTypes = (
GIF => 'image/gif',
JPE => 'image/jpeg',
JPEG => 'image/jpeg',
SHTML => 'text/html',
SHTM => 'text/html',
HTML => 'text/html',
HTM => 'text/html',
TXT => 'text/plain',
INI => 'text/plain',
DOC => 'application/x-msword',
EML => 'message/rfc822',
);
sub GuessCType {
my $ext = shift;
$ext =~ s/^.*\.//;
return $CTypes{uc $ext} || 'application/octet-stream';
}
by:
sub GuessCType {
guess_media_type($_[0]);
}
And you would immediately support more file types.
Subject: | Sender.patch |
--- Sender.pm.orig 2009-12-24 00:44:19.000000000 +0100
+++ /opt/local/lib/perl5/site_perl/5.8.9/Mail/Sender.pm 2009-12-24 00:38:53.000000000 +0100
@@ -6,6 +6,7 @@
package Mail::Sender; local $^W;
require 'Exporter.pm';
+use LWP::MediaTypes qw(guess_media_type);
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA = (Exporter);
@EXPORT = qw();
@@ -941,25 +942,8 @@
return $self;
}
-use vars qw(%CTypes);
-%CTypes = (
- GIF => 'image/gif',
- JPE => 'image/jpeg',
- JPEG => 'image/jpeg',
- SHTML => 'text/html',
- SHTM => 'text/html',
- HTML => 'text/html',
- HTM => 'text/html',
- TXT => 'text/plain',
- INI => 'text/plain',
- DOC => 'application/x-msword',
- EML => 'message/rfc822',
-);
-
sub GuessCType {
- my $ext = shift;
- $ext =~ s/^.*\.//;
- return $CTypes{uc $ext} || 'application/octet-stream';
+ guess_media_type($_[0]);
}
sub Connect {